Maintaining Menu Item Properties

The Menu Item sheet is displayed when you first access the Menu Design dialog or when you click the Menu Item sheet on the Menu Design dialog.

To create a menu item, you must specify a value in the Caption and Name text boxes. The Name value is required only if the menu that you are defining does not have a submenu or the menu item is defined as a separator. You can specify any other properties later, if necessary. (For details about creating a menu separator dynamically at run time, see the MenuItem class caption property in Chapter 1 of the JADE Encyclopaedia of Classes.)

To maintain the properties on the Menu Item sheet

  1. In the Caption text box, specify the text to be displayed as the label text for your menu item.

    The caption property for a menu is a string with a maximum length of 100 characters.

    You can use the MenuItem class caption property to assign an access key to your menu. In the caption, include an ampersand character (&) immediately preceding the character that you want for an access key. The character is underlined. At run time, press Alt followed by your underlined character to move the focus to that control.

    To include an ampersand character in a caption without creating an access key, enter two ampersand characters (&&). A single ampersand character is then displayed in the caption and no characters are underlined.

  2. In the Name text box, specify the internal name for your menu item. The name must start with a letter, and can include numbers and underscore characters, but cannot include punctuation symbols or spaces.

  3. If you want quick access to this menu, use the Shortcut Key combo box to select a shortcut key. (You cannot apply a shortcut key to menu items that have submenus.)

    The Painter checks that the shortcut key combination is not already assigned to a menu item on the form being painted, any superclass forms, and any subclass forms.

    If the selected shortcut key combination (for example, Ctrl+F2) is already assigned, the Allow reuse? warning message is displayed, identifying which schema, form, and menu item already has that shortcut key assigned. You are prompted to click the:

    • No button if you do not want the shortcut key or keys reused. The Shortcut Key combo box is then reset to the previously selected entry.

    • Yes button, to update the menu item with the selected shortcut key or keys.

  4. If you want to display a picture on your menu label, select Picture in the Picture combo box. The common File Open dialog is then displayed, to enable you to select the required graphics file.

  5. If you want the menu disabled at run time, uncheck the Enabled check box.

  6. If you want to hide the menu at run time, uncheck the Visible check box.

  7. If you do not want to use the default background area of a menu, uncheck the Default Back Color check box. The common Color dialog is then displayed, to enable you to select the background color that you require.

    The background color is used only when an inner image is not set or it is not a brush.

  8. If you do not want the foreground color of menu text, uncheck the Default ForeColor check box. The common Color dialog is then displayed, to enable you to select or define the foreground color that you require for menu text.

  9. To check a menu item, check the Checked check box. At run time, a checked menu has a check mark displayed to the left of it. (You cannot check menu items with submenus.)

  10. To specify a separator line in the current menu, check the Separator? check box.

    A separator line logically separates groups of commands.

    The following sequence of events is required to insert a separator in the current menu.

    1. Click the blank cell at the bottom of the menu.

    2. Click the Separator check box so that it is checked (selected).

    3. Enter the appropriate caption and name details in the Menu Item sheet.

  11. When you have created your top-level menu item, you can then select the:

    1. Window List? check box, to automatically include the Window menu containing the standard CUA menu commands on your menu bar. (This check box is checked by default.)

      The Close All MDI Forms command is displayed in the Window menu list on the Menu Item sheet only when the Window List? check box is checked. To add the Close All MDI Forms command to an existing Window list menu, uncheck the Window List? check box and then check it again.

      At run time, if you select this menu item, all visible, enabled forms that do not have the allowClose property set to false are unloaded as if the user has selected the Close button on each MDI child form. The Form class queryUnload and unload event methods are called, as normal. If any form rejects the unload (via the cancel parameter in the queryUnload event method), the unloading process will cease.

      In addition, if the MDI frame has no visible and enabled MDI child windows displayed at run time, the Arrange Icons, Cascade, Close All MDI Forms, New Window, Tile Horizontal, Tile Vertical, and Close All Windows menu items are disabled.

    2. Help List? check box, to automatically include the Help menu containing the standard CUA help commands on your menu bar (that is, the Index and About commands).

      When the Index command is selected, help is displayed based on the value of the helpKeyword property. If the value of the helpKeyword property is null, displayed help is based on the value of the helpContextId property. If this is zero (0), index help is displayed. The click method is never executed.

      The click method is never executed when the About command is selected.

    3. Has Submenu? check box, to automatically create a submenu for the selected menu item. (Menu items that have submenus cannot be checked or have a shortcut key applied.)

    Top-level menus marked as a Window list or a Help list by using these check boxes are always placed in the correct Windows order at run time and in the JADE Painter (that is, the Window menu followed by the Help menu are always the last two menus, regardless of where they are placed in the Menu Designer). The position of these menus is based on the setting of the Window List? and Help List? check boxes, and not the names specified in the Name text box.

    If you check only the Window List? check box, the Window menu is the last menu on the menu bar.