Working with IMenuItem Parts

The following tasks are associated with using an IMenuItem* part in visual composition. Tasks that are common to many parts are described in related topics.

Defining text for a menu item
To define text for the menu item, do either of the following:

Defining a mnemonic
If you want to establish a mnemonic for the menu item, type a tilde (~) before the mnemonic character in the menu item text. For Windows, VisualAge maps the tilde to an ampersand (&). If you type an ampersand, the mnemonic is not portable.

Assigning a bitmap
To assign a bitmap to the menu item instead of using text, set the bitmap property in the IMenuItem* property sheet. In the Resource Id prompter property window, specify a bitmap resource by setting the following fields:

Defining an accelerator
To define an accelerator for the menu item, set the Accelerator key property in the IMenuItem* property sheet. Define the accelerator in the prompter for the value column.

Defining menu help information
You can define help information about the menu item. This text appears in the frame window information area when the user selects the menu choice. To define help information for the menu item, set the Info area text property in the IMenuItem* property sheet. Enter the text in the value column.

Preselecting the choice
To preselect the menu item, set the checked property in the IMenuItem* property sheet. Select true in the value column.

Moving a menu item
To move the menu item within your menu, drag the IMenuItem* part to a new location in the IMenu* part.

Setting the initial state
To specify whether the menu item is initially enabled, set the disabled property in the IMenuItem* property sheet.

Disabling a menu item
To disable the menu item when an event occurs, such as selection of another item, connect the event to the IMenuItem* disable action.

Enabling a menu item
To enable the menu item when an event occurs, such as selection of another item, do the following:
  1. Connect the event to the IMenuItem* enable action.
  2. The enable action enables the part by default. If you have changed this default, open settings for the connection, select Set parameters, and set the parameter value to true.

Calling an action from a menu item
To start an action when the user selects the menu item, connect the IMenuItem* commandEvent feature to the target action.


Related procedures
Setting Part Style Properties
Editing Part Labels Directly
Working with VisualAge User Interface Parts

Related references
IMenuItem
Property Settings -- IMenuItem
Portability -- IMenuItem