PreviousNextIndex

DEFINE SUB-MENU statement

Defines a submenu widget that is created at compile time for use within a single procedure or class. You can use a submenu widget as a pull-down menu within a menu bar or as a submenu of a pull-down menu or pop-up menu.

Note: Does not apply to SpeedScript programming.
Syntax

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

[ PRIVATE ] SUB-MENU submenu
SUB-MENU submenu
BGCOLOR expression
DCOLOR expression
FGCOLOR expression
PFCOLOR expression
FONT number
SUB-MENU-HELP
LIKE menu
menu-element-descriptor
RULE
SKIP
SUB-MENU submenu [ DISABLED ] [ LABEL label ]
menu-item-phrase
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
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 HANDLE NO-UNDO. 
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 = FALSE. 
  MENU-ITEM m2:SENSITIVE IN MENU myobjects = FALSE. 
  MENU-ITEM m3:SENSITIVE IN MENU myobjects = FALSE. 
  MENU-ITEM m4:SENSITIVE IN MENU myobjects = TRUE. 
END. 
ON CHOOSE OF b2 IN FRAME x DO: 
  MENU-ITEM m1:SENSITIVE IN MENU myobjects = TRUE. 
  MENU-ITEM m2:SENSITIVE IN MENU myobjects = TRUE. 
  MENU-ITEM m3:SENSITIVE IN MENU myobjects = TRUE. 
  MENU-ITEM m4:SENSITIVE IN MENU myobjects = FALSE. 
END. 
WAIT-FOR CHOOSE OF MENU-ITEM m3 IN MENU myfile. 
DELETE WIDGET mywin. 

Notes
See also

Class-based data member access, CREATE widget statement, Trigger phrase


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex