TOPIC: Add button to nav pane in Access?
#1543
Add button to nav pane in Access? 10 Months, 4 Weeks ago
In an access control, is it possible to add a button to the First, Prev, Next, Last, ... area? Actually, to the Current button would be great. I'd like the ability to add a function to Duplicate an existing record but with some sequential data changed. Duplicating the record is not the problem, linking into the Access control is.

Any ideas? When reading the source for AccessControl, I see:
Code:


set_current_menu(args)
  {
    .option = args.GetDefault('option', 'Access')
    .current_plugins = Object()
    current_menu = Object('Save', 'Print...')
    Plugins().ForeachContribution('AccessMenus', 'Current')
      { |c|
      if c.Member?('option') and c.option isnt .option
        continue
      if c.GetDefault('devel', false) is true and
            Suneido.User isnt 'default'
        continue
      if c[2] is 'History' and .historyFields is false
        continue
      current_menu.Add(c[2])
      .current_plugins[c[2]] = c[2] is 'History' ? Object(view: c.view, update: c.update) : c[3]
      }
    if .protectField isnt false
      current_menu.Add('Reason Protected')
    //added at the bottom to mitigate accidental deletions
    current_menu.Add('', 'Restore', '', 'Delete', #('Delete'))
    return current_menu
  }



I guess I do not know what Plugins().ForeachContribution('AccessMenus', 'Current') actually is or how (or if I can even) interface with it. I would only want this functionality on one Access, not all Accesses.

Jeremy
 
 
Last Edit: 2009/09/28 03:38 By jeremy_c. Reason: Formatted code.
 
#1544
Re:Add button to nav pane in Access? 10 Months, 4 Weeks ago
You are on the right track. Here is an example:

Code:

Plugin_InGlSources

#(
Contributions:
    (
    (AccessMenus, Current, option: InTransactions, 'Drill Down',
        function (data, hwnd, access)
            { Gl_DrillDown('gltran_subsys_num', data.intran_num_new, hwnd, access) })
    )
)


You need to put a matching option: on the access as well.
 
 
andrew
 
#1545
Re:Add button to nav pane in Access? 10 Months, 4 Weeks ago
The Plugin lets you add to the Current menu without having to inherit any code (See Language > Reference > Plugins in the Help). Here is a quick run through of how you could add to the Current menu of a specific AccessControl:


  1. Create a new record in your library named "Plugin_<some name>"

  2. The code for this record will be setup something like this:

  3. Code:

    #(
    Contributions:
        (
        (AccessMenus, Current, option: <the name of your access goes here>, 
            <the name of your menu option goes here>,
            function (data, hwnd, access)
                {
                <the code to be executed when your option is selected goes here>
                })
        )
    )




This is exactly like Andrew's post. I guess I was a little slow on the response :o)
Hope that helps.
 
 
Last Edit: 2009/09/28 17:33 By jennebelle.