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
NEW SHARED MENUmenu-name
SHARED MENUmenu-name
[ PRIVATE ] MENUmenu-name
Defines and identifies a menu widget as a class-scoped object. A class-scoped handle-based object is not a member of a class, but provides a resource that is privately available to the class definition similar to a non-shared data element in a procedure definition. The option to specify the PRIVATE access mode is provided for readability. You cannot specify PRIVATE when defining a menu widget as a data element in a method or procedure.Note: This option is applicable only when defining a class-scoped menu widget in a class definition (.cls
) file.MENUmenu-name
BGCOLORexpression
DCOLORexpression
FGCOLORexpression
PFCOLORexpression
FONTnumber
MENUBARTITLEtitle
LIKEmenu
menu-element-descriptor
RULESKIPSUB-MENUsubmenu
[ DISABLED ] [ LABELlabel
]menu-item-phrase
MENU-ITEMmenu-item-name
ACCELERATORkeylabel
Specifies a keyboard accelerator for this menu item. A keyboard accelerator is a key—sometimes modified by SHIFT, CONTROL, or ALT—that chooses a menu item even if the menu is not displayed. The valuekeylabel
must be character-string expression that evaluates to a valid key label recognized by the AVM, such as a, F1, or ALT+SHIFT+F1. See the chapter on handling user input in the OpenEdge Development: Programming Interfaces for the precedence rules that the AVM uses for handling keyboard input.BGCOLORexpression
DCOLORexpression
DISABLEDFGCOLORexpression
FONTexpression
LABELlabel
Specifies the text that is displayed in the menu for a choosable menu item or submenu. Include an ampersand (&) within the label to assign the following letter 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 two ampersands (&&).PFCOLORexpression
READ-ONLYTOGGLE-BOXtrigger-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.ExampleThe
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.
Notes
- You cannot define a SHARED or NEW SHARED menu widget in a persistent procedure. If you do, ABL raises ERROR on the RUN statement that creates the procedure.
- You cannot define a SHARED or NEW SHARED menu widget in a class definition (
.cls
) file. If you do, ABL generates a compilation error.- Keyboard accelerators are specified for menu-items forward and backward. The user can press PAGE-DOWN key to look at the next Customer record and the PAGE-UP to view the previous Customer record.
- The menu item quititem has a label E&xit; the ampersand makes X the mnemonic for that menu item.
- You cannot define a submenu with the same name more than once in the same menu tree. Thus, if menu mFile contains both submenu mOptions and submenu mSave, submenu mSave cannot also contain submenu mOptions.
- Menu items in different menus and submenus can have the same names. In the above procedure, the menu items in myfile and myobjects share the same names. To avoid ambiguity, use the IN MENU or IN SUB-MENU option to identify the parent menu or submenu.
- There are instances where you cannot avoid ambiguity in menu item references. In such instances, ABL always references the first unambiguous instance of the menu item. In particular, if the same submenu containing a menu item appears in more than one menu and each menu defines another instance of the same menu item, you can only reference that menu item in the submenu from the first menu that contains it. Thus, if submenu mOptions contains menu item mSave and the menus mFile and mDraw (in that order) both contain submenu mOptions and another menu item mSave, you can only reference menu item mSave in submenu mOptions from menu mFile. You cannot uniquely reference menu item mSave in submenu mOptions from menu mDraw because menu mDraw contains another menu item mSave.
See alsoClass-based data member access, COLOR phrase, DEFINE SUB-MENU statement, RUN statement
OpenEdge Release 10.2B
|