| Directives |
|
| Format | POPUP_MENU
[@(col,ln)],
list$, [strvar$|numvar] Where: |
|||||||||||||
| @(col,ln) | Numeric expressions. The optional column and line position on the current window where the menu will appear. | |||||||||||||
| list$ | Menu structure and elements. String expressions. Maximum 2047 | |||||||||||||
| elements. A bitmap/icon can be included for each element. | ||||||||||||||
| numvar | Name of variable that receives the numeric value of the selection made. | |||||||||||||
| strvar$ | Name of variable that receives the string containing the selection sequence of characters selected. | |||||||||||||
| Description | Use
the POPUP_MENU directive to create and
process floating menus. A popup menu "pops up"
on top of the current window when you right-click the
mouse while the pointer is over a control, such as a
button, multi-line, or list box. Once a popup menu is
created and assigned to a control, it remains invisible
until the user right-clicks
the mouse button over the enabled component. In a popup
menu, a default option may be specified.
POPUP_MENU definition uses a format similar to the MENU_BAR Directive:
Numeric values are assigned to each entry in the menu definition. By default, the first entry has the value ', the second ', etc. This value can be overridden by placing an equal sign and numeric value after the menu item text; e.g.,
Quit would have a value of four. In addition, the starting numeric value can be changed or reset by placing a # followed by the new starting point within the menu definition string outside of group definitions. When setting a new starting value, the next menu selection will be assigned a number that is one more than the starting point; e.g.,
This defines File as one, uit as two, File-pen as 1001, File-ave as 1002, and File-ename as 1003. Accelerator keys should be unique for each selection on a given sub-menu within a group. While the use of duplicate accelerator keys is permitted, it is difficult to determine which selection was made by using just the character strings. Menu items can be disabled, displayed in bold or with a checkmark, by placing a "D", "B", or "C" after the = (equal sign) and before the value to return; e.g.,
The resulting menu shows
"Two" checked, "Three" disabled,
and "Four" both bolded and checked. A POPUP_MENU can be associated with buttons, check boxes, drop boxes, grids, list boxes, multi-lines, radio buttons and tristate boxes. The directives that control these objects, include a MNU= option that defines the CTL number that will be generated when the user right-clicks on the control. 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. For more information on
internal/external images and recognized image file types,
refer to Displaying Bitmaps/Icons. |
|||||||||||||
| Two-Tone Effects | The
POPUP_MENU 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 system-supplied Cut, Copy, Paste, and Delete menu items will adhere to the FILL(arg) and LEFT(arg) definitions for the menu. | |||||||||||||
| See Also | MENU_BAR Directive BUTTON Control Button, CHECK_BOX Control Check Box DROP_BOX Control Drop Box GRID Control Grid LIST_BOX Control List Box MULTI_LINE Control Multi-Line Input RADIO_BUTTON Control Radio Button TRISTATE_BOX Control Tristate Box |
|||||||||||||
| Example | This
popup menu returns a numeric value assigned by the menu
bar definition
|
|||||||||||||