Setting General properties for menu items

This section describes the properties you can set when you select a menu item and then select the General tab page in the Properties view.

Creating MicroHelp and tags

MicroHelp is a brief text description of the menu item that displays on the status bar at the bottom of a Multiple Document Interface (MDI) application window. Type the text you want to display in the MicroHelp box. For examples of MicroHelp text, select an item from a menu in PowerBuilder and look at the text that displays in the status bar.

A tag is a text string that you can associate with an object and use in any way you want.

For information about defining MicroHelp text and tag properties, see the chapter on building MDI applications in Application Techniques.

Setting the appearance of a menu item

On the General tab page in the Properties view, you can also specify how a menu item appears at runtime.

Table 14-3: Setting display properties for menu items

Property

Meaning

Visible

Whether the menu item is visible. An invisible menu item still displays in the WYSIWYG and Tree Menu views, but at runtime, it will not display. In WYSIWYG Menu view, an invisible item has faded and dotted text.

Enabled

Whether the menu item can be selected.

Checked

Whether the menu item displays with a check mark next to it.

Default

Whether the menu item text is bold. In a pop-up menu, Default indicates what action occurs if the user double-clicks instead of right-clicks on an item. In dragging, Default indicates what happens when an item is dragged with the left mouse button instead of the right mouse button.

ShiftToRight

Whether the menu item shifts to the right (or down for a drop-down or cascading menu) when you add menu items in a menu that is inherited from this menu. Selecting this property allows you to insert menu items in descendent menus, instead of being able to add them only to the end.

For more information, see “Inserting menu items in a descendent menu”.

MergeOption

The way menus are modified when an OLE object is activated. Options are: File, Edit, Window, Help, Merge, Exclude.

For more information, see the chapter about using OLE in an application in Application Techniques.

MenuItemType

Whether the menu item you are creating is Normal, About, Exit, or Help type.

The settings you specify here determine how the menu items display by default. You can change the values of the properties in scripts at runtime.

Assigning accelerator and shortcut keys

Every menu item should have an accelerator key, also called a mnemonic access key, which allows users to select the item from the keyboard by pressing Alt+key when the menu is displayed. Accelerator keys display with an underline in the menu item text.

You can also define shortcut keys, which are combinations of keys that a user can press to select a menu item whether or not the menu is displayed.

For example, in the following menu all menu items have accelerator keys: the accelerator key is N for New, O for Open, and so on. New, Open, Close, and Print each have shortcut keys: the Ctrl key in combination with another key or keys.

Shown is a menu where the accelerator keys are displayed

You should adopt conventions for using accelerator and shortcut keys in your applications. All menu items should have accelerator keys, and commonly used menu items should have shortcut keys.

If you specify the same shortcut for more than one MenuItem, the command that occurs later in the menu hierarchy is executed.

Some shortcut key combinations, such as Ctrl+C, Ctrl+V, and Ctrl+X, are commonly used by many applications. Avoid using these combinations when you assign shortcut keys for your application.

StepsTo assign an accelerator key:

  1. Type an ampersand (&) before the letter in the menu item text that you want to designate as the accelerator key.

    For example, &File designates the F in File as an accelerator key and Ma&ximize designates the x in Maximize as an accelerator key.

StepsTo assign a shortcut key:

  1. Select the menu item to which you want to assign a shortcut key.

  2. Select the General tab in the Properties view.

  3. Select a key from the Shortcut Key drop-down list.

    Shown is a group box titled Shortcut Key. It has a drop down list and check boxes for Shortcut Alt, Shortcut Control, and Shortcut Shift.
  4. Select Shortcut Alt, Shortcut Ctrl, and/or Shortcut Shift to create a key combination.

    PowerBuilder displays the shortcut key next to the menu item name.