After you have created and modified a menu button, you can add the menu items to the menu.

To add a menu item to a menu

  1. Select the button and click, View, and then click Menu Items to open the Menu Designer.

  2. The first field, Visible, is set to Yes by default. Leave this as is.

  3. Add the menu items by filling out the Caption field. If you do not create a shortcut key (by embedding an ampersand in the Caption text), the first letter of each caption will be used as a shortcut key. If you add menu items that start with the same letter, set the shortcuts yourself to avoid overloading.

  4. You can also define a shortcut key by entering the name of the key in the ShortCutKey field. The following table shows the different ways to enter keys.

    Key Entered As

    Function keys

    F1, F2, F3, ...

    CONTROL, ALT, SHIFT

    CTRL, ALT, SHIFT

    Other keys

    A, B, C, ... (these keys must be part of a key combination with CTRL or

    ALT).

    Key combinations

    For example: CTRL+A, SHIFT+F2

  5. A shortcut key is active as long as the focus is on the form that the menu button is a child of. Avoid accidentally overloading the key combinations so that they perform different actions when different forms have the focus. You should also try to avoid using shortcut keys that the system already uses.

  6. In the Action field, enter the action that you want the menu item to initiate. You can use the drop-down list to select the action from a list. Alternatively, you can write C/AL code in the OnPush trigger of the menu item.If you select RunObject you can choose to run either a form, a report, or a codeunit.

  7. In the RunObject field, click the lookup button to select the object that you want to use to run the menu item. For other parameterized actions (such as, RunSystem) you must set the parameters in the Properties window of the menu item. For more information about setting parameters, see Adding Other Menu Items.

See Also