Progress
Language Tutorial
for Windows


Defining a Submenu

When you assemble a menu, you first define the pull-down submenus and their associated menu items with the DEFINE SUB-MENU statement. This is the basic syntax for the DEFINE SUB-MENU statement.

SYNTAX
DEFINE SUB-MENU submenu-name
  { LIKE menu | menu-element-descriptor ... } 

The LIKE menu option is useful when you want to duplicate an already existing menu. The menu-element-descriptor allows you to customize the submenu. This is the syntax for the menu-element-descriptor phrase.

SYNTAX
{ SUB-MENU submenu-name
  [ DISABLED ] [ LABEL label ]
  | RULE
  | SKIP
  | menu-item-phrase
} 

Table 11–1 explains the relevant components of the syntax.

Table 11–1: MENU Element Options
Component
Description
SUB-MENU
Names a submenu that displays when the user chooses this menu item. The specified submenu must already be defined.
DISABLED
Disables the menu item initially. When you use this option, the user can’t choose the menu item.
LABEL
Defines the text descriptor that the user sees on the menu. If you omit LABEL, Progress displays the submenu name by default.
RULE
Inserts a rule (line) at this point on the menu. Use rules to visually group related commands.
SKIP
Inserts a blank line at this position on the menu.
menu-item-phrase
Names a menu-item widget and specifies details about the item. See the following table for more information.

The menu-item-phrase lets you customize both how the menu item displays and how the user can access it. This is the syntax for the menu-item-phrase.

SYNTAX
MENU-ITEM item-name 
  [ ACCELERATOR keylabel ]
  [ TOGGLE-BOX ]
  [ DISABLED ]
  [ LABEL label ] 

Table 11–2 explains the relevant components of the syntax.

Table 11–2: MENU–ITEM Options
Component
Description
MENU-ITEM
Specifies a unique name for the menu item. This name doesn’t have to be previously defined.
ACCELERATOR
Specifies the keyboard accelerator for this menu item. A keyboard accelerator is a key that chooses a menu item even if the menu item is not displayed. This option is available only in graphical windowing environments.
TOGGLE-BOX
Displays the menu item with a toggle box that the user can toggle on or off.
DISABLED
Disables the menu item. This means that the user cannot choose this item.
LABEL
Specifies the text descriptor that the user sees in the submenu. If you omit LABEL, Progress displays the item name by default.

You can include an ampersand (&) within the label to indicate that the following letter acts as a mnemonic (shortcut key) for the menu item. For example, "E&xit" specifies “x” as the mnemonic.

Note that in this code fragment, which is an example of a complete submenu definition, only the final MENU-ITEM phrase has a period:

DEFINE SUB-MENU sm-Reports
    MENU-ITEM mi-Labels      LABEL "Customer Labels"
    MENU-ITEM mi-Names       LABEL "Customer Names"
    RULE 
    MENU-ITEM mi-Balances    LABEL "Order Totals"
    MENU-ITEM mi-Today        LABEL "Order Items". 

The next step in building a menu is to define a menu bar and add submenus and items to it.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095