Progress
Language Reference


DEFINE SUB-MENU Statement

Interfaces
OS
SpeedScript
All
All
No

Defines a submenu. You can use a submenu as a pull-down menu within a menu bar or as a submenu of a pull-down menu or pop-up menu.

SYNTAX

DEFINE SUB-MENU submenu
  [ BGCOLOR expression ]
  [ DCOLOR expression ]
  [ FGCOLOR expression ] 
  [ PFCOLOR expression ]
  [ FONT number ]
  [ SUB-MENU-HELP ] 
  { LIKE menu | menu-element-descriptor ... } 

SUB-MENU submenu

The name of the submenu you are defining.

BGCOLOR expression

Specifies the background color for the submenu in graphical interfaces. This option is ignored in character interfaces and Windows.

DCOLOR expression

Specifies the display color for the submenu in character interfaces. This option is ignored in graphical interfaces.

FGCOLOR expression

Specifies the foreground color for the submenu in graphical interfaces. This option is ignored in character interfaces.

PFCOLOR expression

Specifies the prompt-for color for the submenu in character interfaces. This option is ignored in graphical interfaces..

FONT number

No effect;supported for backward compatibility only.

SUB-MENU-HELP

No effect;supported for backward compatibility only.

LIKE menu

Specifies a previously defined menu or submenu whose characteristics you want to apply to the new submenu. If you name a menu with this option, you must have previously defined that menu in the procedure. If you name a submenu with this option, that submenu must have already been used as part of a menu definition.

menu-element-descriptor

Specifies an element displayed on the menu. Each element is either a choosable menu item, a submenu, nonchoosable text, a rule, or a blank space. You must specify one or more menu elements, unless you use the LIKE option.

This is the syntax for menu-element-descriptor.

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

RULE

Specifies that a rule or line is inserted at this point in the submenu. You can use this, for example, to divide the submenu into sections.

SKIP

Specifies that a blank line is inserted at this point in the submenu. You can use this, for example, to divide the submenu into sections.

SUB-MENU submenu [ DISABLED ] [ LABEL label ]

Specifies that a submenu is displayed at this menu item. The submenu must be previously defined in the procedure. The submenu appears when the user chooses that item. The submenu cannot be a menu bar. The DISABLED and LABEL options for a submenu are the same as described for the menu-item-phrase.

menu-item-phrase

Specifies a choosable menu item. This is the syntax for menu-item-phrase.

SYNTAX
MENU-ITEM menu-item-name 
  [ ACCELERATOR keylabel ]
  [ BGCOLOR expression ]
  [ DCOLOR expression ]
  [ DISABLED ]
  [ FGCOLOR expression ] 
  [ FONT expression ]
  [ LABEL label ]
  [ PFCOLOR expression ]
  [ READ-ONLY ]
  [ TOGGLE-BOX ]
  { [ trigger-phrase ] } 

MENU-ITEM menu-item-name

The name of the menu item you are defining.

ACCELERATOR keylabel

Specifies a keyboard accelerator for this menu item. A keyboard accelerator is a key-possibly modified by SHIFT, CONTROL, or ALT-that chooses a menu item even if the menu is not displayed. The value keylabel must be character-string expression that evaluates to a valid key label recognized by Progress, such as a, F1, or ALT-SHIFT-F1.

BGCOLOR expression

Specifies the background color for the menu item in graphical interfaces. If you omit this option, the menu item inherits the background color of the submenu.

DCOLOR expression

Specifies the display color for the menu item in character interfaces. If you omit this option, the menu item inherits the display color of the submenu.

DISABLED

Specifies that the menu item is initially disabled for input. This means that the user cannot choose this item. Disabled items are grayed out in environments that support it.

FGCOLOR expression

Specifies the foreground color for the menu item in graphical interfaces. If you omit this option, the menu item inherits the foreground color of the submenu.

FONT expression

Specifies the font for the menu item. If you omit this option, the menu item inherits the font of the menu.

LABEL label

Specifies the text that displays in the submenu for a choosable menu item or submenu. If you omit LABEL, Progress displays the item handle by default.

You can include an ampersand (&) within the label to indicate that the following letter acts as a mnemonic for the menu item. This means that when the menu is displayed, the user can choose the item by pressing that single key. If you do not include an ampersand within the label, Windows treats the first character as a mnemonic. To include a literal ampersand within a label, specify a double ampersand (&&).

PFCOLOR expression

Specifies the prompt-for color for the menu item in character interfaces. If you omit this option, the menu item inherits the prompt-for color of the submenu.

READ-ONLY

Specifies that this menu item is read-only text. The user cannot choose this item.

TOGGLE-BOX

Specifies that the menu item is displayed as a checkbox that the user can toggle on or off. In environments that do not support this option, it is ignored.

trigger-phrase

Specifies application triggers for the menu item. Typically, you associate a CHOOSE trigger with each menu item.

For more information, see the Trigger Phrase reference entry.

EXAMPLE

The r-menu.p procedure defines three pull-down submenus. One of the submenus, myedit, contains a nested submenu, myobjects. The procedure defines a menu bar, mybar, that contains two submenus labelled File and Edit. The handle of mybar is assigned to a window mywin. The ON statements define triggers to execute when you choose the corresponding menu items.

r-menu.p
DEFINE VARIABLE mywin AS WIDGET-HANDLE.
DEFINE SUB-MENU myfile
   MENU-ITEM m1  LABEL "Save"
   MENU-ITEM m2  LABEL "Save As"
   MENU-ITEM m3  LABEL "Exit".DEFINE SUB-MENU myobjects
   MENU-ITEM m1  LABEL "Circle"
   MENU-ITEM m2  LABEL "Line"
   MENU-ITEM m3  LABEL "Rectangle"
   MENU-ITEM m4  LABEL "Text".DEFINE SUB-MENU myedit
   SUB-MENU myobjects LABEL "Add"
   MENU-ITEM e1       LABEL "Delete"
   MENU-ITEM e2       LABEL "Copy".DEFINE MENU mybar  MENUBAR
   SUB-MENU myfile LABEL "File"
   SUB-MENU myedit LABEL "Edit".
CREATE WINDOW mywin
   ASSIGN MENUBAR = MENU mybar:HANDLE.DEFINE BUTTON b1 LABEL "Text Mode".
DEFINE BUTTON b2 LABEL "Graphics Mode".CURRENT-WINDOW = mywin.
FORM 
   b1 at X 10  Y 120 
   b2 at x 120 Y 120
   WITH FRAME x.ENABLE b1 b2 WITH FRAME x.
ON CHOOSE OF b1 IN FRAME x DO:
   MENU-ITEM m1:SENSITIVE IN MENU myobjects = NO.  
   MENU-ITEM m2:SENSITIVE IN MENU myobjects = NO.
   MENU-ITEM m3:SENSITIVE IN MENU myobjects = NO.
   MENU-ITEM m4:SENSITIVE IN MENU myobjects = YES.    
END.

ON CHOOSE OF b2 IN FRAME x DO:
   MENU-ITEM m1:SENSITIVE IN MENU myobjects = YES.  
   MENU-ITEM m2:SENSITIVE IN MENU myobjects = YES.
   MENU-ITEM m3:SENSITIVE IN MENU myobjects = YES.   
   MENU-ITEM m4:SENSITIVE IN MENU myobjects = NO.  
END.

WAIT-FOR CHOOSE OF MENU-ITEM m3 IN MENU myfile.
DELETE WIDGET mywin. 

NOTES

SEE ALSO

CREATE Widget Statement, Trigger Phrase


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