Defining a context menu
On the other hand, a dynamic context menu provides you greater flexibility with the menu items. The values for the menu items are attached at run-time. Menu from any of the supported AR System menu types can be attached. See Defining-application-menus. You can use entries from an existing AR System form as menu items by attaching it to a context menu.
The following figure shows the dynamic context menu with a label. In this case, the menu items are added as a sub-menu.
Dynamic context menu with label
The following figure shows the dynamic context menu without a label. In this case, the dynamic context menu is attached to the main menu.
Dynamic context menu without label
For more information about workflows, see Workflow-considerations-for-table-fields. For more information about creating sub-menus, see Creating-character-menus.
To create a static context menu
- Open the form to which you want to add the context menu.
- Add the required table fields to the form. For more information, see Adding-a-table-field-to-a-form.
Right-click on the table and select Edit Menu/Navigation Items.
The Edit Context Menu dialog box is displayed.Alternatively, you can also select the table field and click Form > Edit Menu/Navigation Items to display the Edit Context Menu dialog box.
In the Edit Context Menu dialog box, use the Add Menu, Add Item, and Add Separator buttons to create menus for the field. These menu items are appended to the default context menu items.
To remove the default context menu items from the context menu, set the labels to "" in Developer Studio.
- Right-click the form, and select Save.
To create a dynamic context menu in a table field
- Setting fields in the form:
- Follow steps 1-5 as specified in to create a static context menu to create a table with context menu.
- Add a Character field and a Button to the form.
- For the Table, Character field, and Button fields added in step a and b, change the Label names to more meaningful names. To do this, open the Display properties in the Properties editor to update the Labels. See Field properties.
- In the Properties editor for the table, open the Database properties for the context menu and copy the Id.
Make a note of the field Id of the context menu item to which the AR System menu will be attached. At run-time, the workflow accepts the field Id and dynamically attaches the context menu. - Right-click the form, and select Save.
- Define an Active Link that attaches the context menu at run-time
- Open a new Active Link and associate the form with it.
- Set the Active Link to execute on the Button field that you have set on the form in step 1b.
- Right-click If Actions and select Add Action > Change Field.
- In the Field list, select Field Value. Click the ellipsis button. From the Field /Keyword Selector dialog box, select the Character field added in step 1b.
The runtime value of this field determines the context menu to be attached. - In the Menu list, select Changed. Enter the name of the menu to attach or click the ellipsis button to select the menu from the Menu/Keyword Selector dialog box.
- Save the Active Link.
If the context menu is disabled, the items attached to the context menu will also appear disabled. Similarly, if the context menu is hidden, the items attached to the context menu are not visible to the user.