| Directives |
|
| Formats |
|
|||||||||||||||||||||||||||||||||||
| Description | Use the MENU_BAR directive to define and control the menu across the top of a window. | |||||||||||||||||||||||||||||||||||
| Format 1 | Define/Create Menu Bar
This format creates a menu bar control object. If the menu bar is not properly defined, ProvideX returns an Error #87: MENUBAR definition invalid. Define the menuef$ of menu groups and elements and identify each item uniquely (e.g., Fand O would identify ile/pen) by marking the character the user can enter in conjunction with the Alt key (e.g., Alt -F) to select the particular item. Use the following format for your string expression:
The example below shows a menu string containing File and Edit, each with a submenu (File: Open, Save, and Quit Edit: Add and Delete). Each item has a shortcut key. Quithas both the shortcut key, Q, and a control ID value, 4.
ProvideX includes the HELPselection on all menu bars by default. You can suppress the HELPselection by inserting a minus sign "-" as the first character in a menu definition string, as in the example above. Right-justify a description of the menu entry (e.g., to tell users what function key will give them quick access to the selection). Use the tab character $09$ to separate the text to be right-justified; e.g.,
Normally, any selection from the menu bar will generate its ctl_id. You can also have individual menu items generate CTL values. To do this, append an equals sign "=" and CTL value to any item in the menu selection list (e.g., &Quit=4, in the example above). It is best to use unique shortcut keys for selections from a given sub-menu in a group. If you have duplicates, you'll have difficulty determining which selection a user makes unless a unique CTL value is assigned to each item. If you omit a shortcut key, ProvideX assigns a value equivalent to the item's placement in the definition string. Add a line to separate options by inserting an additional comma ,as a place holder in the definition string (e.g., between &Open &Save).
Menu items can be disabled
or displayed in bold or with a checkmark,
by placing a "D", "B", or
"C" after
the = (equal sign) and before the assigned CTL value. ;
e.g., Images can be included for each item in the menu. Enclose the image name in curly braces and place it in the menu definition just prior to the specific item text; e.g.,
Use a leading exclamation point (!) to identify the image as internal, or specify the relative path and filename to access an image file that is external..The first bitmap determines the dimensions used to display menu items (up to 64x64). Bitmap/Image transparency options can also be included. "T"indicates use of the upper left most pixel colour, and "G" means use gray colour as transparent (RGB: 192,192,192) as in E:[{!Copy,t}&Copy,{!Paste,g}&Paste]. For more information on internal/external images and recognized image file types, refer to Displaying Bitmaps/Icons |
|||||||||||||||||||||||||||||||||||
| Two-Tone Effects | The
MENU_BAR directive supports the use of
two optional parameters for defining background and left
edge colours in menus (similar to MS Office
applications):
In the following example, the RGB colour 200,200,200 is used for the left edge of all entries in this menu
The next example uses the RGB colour 255,255,150 as the background colour for all of the text portion of the menu.
|
|||||||||||||||||||||||||||||||||||
| *Note* | The colours only affect vertical portions on the menu, not the area that runs horizontally across the top. | |||||||||||||||||||||||||||||||||||
| Format 2 | Read Selected Item
When a user selects any of the items from a menu bar, ProvideX generates the ctl_id you assigned to the menu bar. You can return the selected CTL value in a string variable by using the MENU_BAR READ directive. A program does not receive the CTL value for the menu item the user has chosen until it is read. |
|||||||||||||||||||||||||||||||||||
| Format 3 | Clear Menu Bar
Use the MENU_BAR CLEAR format to remove the menu bar from the current window until a BEGIN or END is executed. |
|||||||||||||||||||||||||||||||||||
| *Note* | Use a MENU_BAR RESET or MENU_BAR CLEAR directive before altering the menu bar. | |||||||||||||||||||||||||||||||||||
| Format 4 | Restore Standard Help
This format resets the current menu bar to the default Help setting. |
|||||||||||||||||||||||||||||||||||
| Format 5 | Set Focus
MENU_BAR GOTO sets the focus on the menu bar. |
|||||||||||||||||||||||||||||||||||
| Format 6 | 'Check'/'Uncheck' Item
The MENU_BAR ON option displays a check mark in front of a specified menu bar item, making it appear that it was selected. MENU_BAR OFF removes the check mark. Toggling: For Formats 6 and 7, Menu items element[$] are usually identified via shortcut keys; e.g., MENU_BAR ON "FPS" toggles items File, Print, Save. When using CTL values, and more than one menu item uses the same CTL, then all menu items using that CTL will be toggled. If toggling just one item, then use that CTL value only. If toggling more than one, then make a string of the CTL values, prefixing a pound sign (#) to each CTL value separated by commas; e.g.,
|
|||||||||||||||||||||||||||||||||||
| Format 7 | Disable/Enable Item
Use the MENU_BAR DISABLE format to gray out the specified menu bar item so that it will be visible but inaccessible to users. To reactivate it, use MENU_BAR ENABLE. See toggling, above. |
|||||||||||||||||||||||||||||||||||
| Format 8 | Remove Menu Bar
This format deletes the menu bar completely from the current session. It cannot be re-displayed until it is redefined. |
|||||||||||||||||||||||||||||||||||