Define a menu bar
- Last Updated: December 29, 2023
- 3 minute read
- OpenEdge
- Version 13.0
- Documentation
You define a menu bar from the bottom up, by defining first the submenus that make up a menu and then the menu itself. In this way, the submenus are already defined when you reference them in the menu bar definition. This is the general syntax for defining a submenu:
|
Every submenu has a name like any other object, which can be used to identify it.
There are other keywords you can use in menu, submenu, and menu item definitions to define colors, fonts, and other details. Check the online Help for details on these attributes.
If two or more menus share the same elements, you can define one to be
LIKE the other. This would more likely be the case for a pop-up
menu rather than a menu bar, if multiple visual objects share many of the same pop-up
menu options.
Otherwise, a submenu definition has one or more menu element descriptors. Each of these can be one of the following:
|
A RULE inserts a line in the submenu to separate groups of related
items. A SKIP simply leaves an empty line, which can serve the same
purpose.
If one submenu contains another, you nest one within the other. You must define the innermost submenu first, so that as each submenu is referenced within another submenu or within the main menu bar itself, its name and definition are already identified.
A nested submenu can be initially disabled. Submenus and menu items have a
SENSITIVE attribute just like other objects, which you can set to
true or false at run time to enable or disable the submenu or menu item.
If you specify a LABEL, then that string appears as a header for the
submenu. Otherwise, the submenu name is used as the default label.
Each menu-item-phrase identifies a single item that the user can choose from the menu, and has this general syntax:
|
Each menu item is an object in its own right, with its own name. The
ACCELERATOR provides a shortcut key for selecting the menu item.
Like a submenu, it can be initially disabled and can have its own label.
If a menu item is marked READ-ONLY, then it appears in the menu but
cannot be chosen. You could use such a menu item as a kind of title for a group of
selectable menu items that appear after it.
A menu item designated as a TOGGLE-BOX represents a logical value. Each
time you select it its logical true/false value is reversed and a check box appears or
disappears in front of the label to indicate this. The CHECKED
attribute tells you at run time whether the item is currently checked or not.
You can define a CHOOSE event trigger phrase in place of a menu item or
you can define an ON CHOOSE block in the procedure following the menu
definition.
Once you define all the submenus your menu bar requires, you define the menu bar itself:
|
Use the MENUBAR keyword to identify that this is a menu bar for a window
and not a pop-up menu. The menu element descriptors for the menu itself can be submenus
and menu items, but not rules or skips.