The AddCommand() function defined in the syListViewCmdBarObj form is used to add a command to a group in the Action Pane for a list.
AddCommand(product_ID, list_ID, view_ID, ParentDictID, ParentFormID, ParentCmdID, sequence, CmdDictID, CmdFormID, CmdID, priority, size, caption, visible {, clone})
• product_ID – The ID of the dictionary that contains the list for which you are adding a command.
• list_ID – An integer specifying the ID of the list for which you are adding a command.
• view_ID – An integer specifying the view for which the command is being added. Use the constant LIST_PRIMARYVIEWID to indicate the primary view for the list.
• ParentDictID – The ID of the dictionary that contains the command list (group in the Action Pane) to which the new command will be added. Use the constant DYNAMICS to specify that you are adding items to a command list that is defined in the Microsoft Dynamics GP main dictionary.
• ParentFormID – The resource ID of the command form that contains the definition of the command list (group in the Action Pane) to which you are adding a command.
• ParentCmdID – The resource ID of the command list (group in the Action Pane) to which you are adding a command.
• sequence – An integer variable that can be used to specify the sequence of the item in the command list. The value 0 specifies the command will be added to the end of the list. The actual position of the command will be returned after the command is added.
• CmdDictID – The ID of the dictionary that contains the command you are adding.
• CmdFormID – The resource ID of the command form that contains the definition of the command you are adding.
• CmdID – The resource ID of the command you are adding.
• priority – An integer that specifies the preferred initial location of the button for the command. The value corresponds to one of the following constants:
Constant |
Example |
---|---|
LISTACTIONPRIORITY_PRIMARY |
|
LISTACTIONPRIORITY_SECONDARY |
|
LISTACTIONPRIORITY_OVERFLOW |
|
• size – An integer that specifies the initial size of the button displayed in the Action Pane for the command. The value corresponds to one of the following constants:
Constant |
Example |
---|---|
LISTACTIONBTNSIZE_SMALL |
|
LISTACTIONBTNSIZE_LARGE |
|
• caption – A string specifying the caption to display for the command when it is displayed in the Action Pane. Set this parameter to the empty string ("").
• visible – A boolean specifying whether the command will initially be visible in the Action Pane. The value true indicates it will be visible, while the value false indicates it will not.
• clone – An optional boolean indicating whether the command should be duplicated for all existing lists of the specified type.
An integer indicating whether the command was added to the Action Pane. The value corresponds to one of the following constants:
Constant |
Description |
---|---|
OKAY |
The command was successfully added. |
DUPLICATE |
The command was not added because it already exists. |
A command displayed in the Action Pane must always be part of a group.
Commands added to the Action Pane must be registered using the List_RegisterAction() function. If you don’t register the commands, they will appear in the Action Pane, but may not be accessible.