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
[ PRIVATE ] SUB-MENUsubmenu
Defines and identifies a sub-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 sub-menu widget as a data element in a method or procedure.Note: This option is applicable only when defining a class-scoped sub-menu widget in a class definition (.cls
) file.SUB-MENUsubmenu
BGCOLORexpression
DCOLORexpression
FGCOLORexpression
PFCOLORexpression
FONTnumber
SUB-MENU-HELPLIKEmenu
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
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—possibly modified by SHIFT, CONTROL, or ALT—that chooses a menu item even if the menu is not displayed. The valuekeylabel
must be a 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 displays in the submenu for a choosable menu item or submenu. If you omit LABEL, the AVM 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 (&&).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-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.
Notes
- To create the compile-time defined submenu you are defining, along with any of its descendents (submenus and menu items), you must define a compile-time defined menu that contains the submenu. Each menu you define that contains the same submenu creates an additional instance of the submenu and each of its descendents. The handles for a compile-time defined submenu and its descendents are not available until the submenu is created in a menu.
- 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.
- When a menu item is disabled, it appears grayed-out (if the environment supports that) and it cannot be chosen.
See alsoClass-based data member access, CREATE widget statement, Trigger phrase
OpenEdge Release 10.2B
|