PreviousNextIndex

DEFINE MENU statement

Defines a menu widget that is created at compile time for use in one or more procedures, or within a single class. You can use a menu widget as a pop-up menu or a menu bar.

Note: Does not apply to SpeedScript programming.
Syntax

DEFINE { [ [ NEW ] SHARED ] | [ PRIVATE ] } MENU menu-name  
  [ FGCOLOR expression ] 
  [ BGCOLOR expression ]  
  [ DCOLOR expression ] 
  [ PFCOLOR expression ] 
  [ FONT number ] 
  [ { TITLE title } | MENUBAR ]  
  [ { LIKE menu } | menu-element-descriptor ... ] 

NEW SHARED MENU menu-name
SHARED MENU menu-name
[ PRIVATE ] MENU menu-name
MENU menu-name
BGCOLOR expression
DCOLOR expression
FGCOLOR expression
PFCOLOR expression
FONT number
MENUBAR
TITLE title
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-bar.p procedure defines a menu bar, mbar, that contains three pull-down submenus labeled Topic, Move, and Exit. The handle of mbar is assigned to the current window. The ON statements define triggers to execute when you choose the corresponding menu items.

r-bar.p 
DEFINE SUB-MENU topic 
  MENU-ITEM numbr    LABEL "Cust. Number" 
  MENU-ITEM addr     LABEL "Address" 
  MENU-ITEM othrinfo LABEL "Other". 
DEFINE SUB-MENU move 
  MENU-ITEM forward  LABEL "NextRec" ACCELERATOR "PAGE-DOWN" 
  MENU-ITEM backward LABEL "PrevRec" ACCELERATOR "PAGE-UP". 
DEFINE SUB-MENU quitit 
  MENU-ITEM quititem LABEL "E&xit". 
DEFINE MENU mbar MENUBAR 
  SUB-MENU topic  LABEL "Topic" 
  SUB-MENU move   LABEL "Move" 
  SUB-MENU quitit LABEL "E&xit". 
ON CHOOSE OF MENU-ITEM numbr 
  DISPLAY Customer.CustNum. 
ON CHOOSE OF MENU-ITEM addr 
  DISPLAY Customer.Address Customer.Address2 Customer.City 
    Customer.State Customer.PostalCode  
    WITH FRAME addr-frame NO-LABELS COLUMN 25. 
ON CHOOSE OF MENU-ITEM othrinfo 
  DISPLAY Customer EXCEPT Customer.Name Customer.CustNum Customer.Address 
    Customer.Address2 Customer.City Customer.State Customer.PostalCode 
    WITH FRAME oth-frame SIDE-LABELS. 
ON CHOOSE OF MENU-ITEM forward DO: 
  HIDE ALL NO-PAUSE. 
  CLEAR FRAME name-frame. 
  FIND NEXT Customer NO-ERROR. 
  IF AVAILABLE Customer THEN 
    DISPLAY Customer.Name WITH FRAME name-frame.  
END. 
ON CHOOSE OF MENU-ITEM backward DO: 
  HIDE ALL NO-PAUSE. 
  CLEAR FRAME name-frame. 
  FIND PREV Customer NO-ERROR. 
  IF AVAILABLE Customer THEN 
    DISPLAY Customer.Name WITH FRAME name-frame. 
END. 
FIND FIRST Customer. 
DISPLAY Customer.Name LABEL "Customer Name" WITH FRAME name-frame. 
ASSIGN CURRENT-WINDOW:MENUBAR = MENU mbar:HANDLE. 
WAIT-FOR CHOOSE OF MENU-ITEM quititem. 

Notes
See also

Class-based data member access, COLOR phrase, DEFINE SUB-MENU statement, RUN statement


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex