pulldown <file>
or
pulldown { <menu_block> }
Display and select from a pop-up menu pulled down from a button menu bar or other menu.
<file>
A text file containing
details of the menu options. The default file extension is .men. If this
parameter is not present, option details will be expected to appear in
a language block following the command line.
<menu_block>
A language block, each line providing details of menu title or options.
None
The format of each line within <menu_block> or <file> is as follows:
<num> {,<num> ...} : { <message> } { ,<switches> } <command_block>
where:
<num>
The option number. A value 0 will indicate a line or title. Any other
value will indicate an option number and should be unique within the block.
Indicating two or more values will equate two or more options.
<message>
The text to be displayed in the title line or menu option.
<command_block>
A block of commands within { and } to be executed when option <num>
is selected. The command block must be enclosed within braces. This can
be omitted in which case the option is treated as a label and is not selectable.
and the following optional switches:
-bc=<color>
The background color for the image (if -im is present).
The default value is no_change which will use the color of the menu background.
-ch
Make the menu option a check (toggle) button instead of a push button
(the default behavior). After selection, its value can be retrieved
via the system numeric menu_switch.
-fc=<color>
The foreground color for the image (if -im is present). This is applicable to monochrome images
only.
-im=<file>
Display a raster image to the left of the text. The value is the name of an image file with, optionally, a
cameo number.
All images in menus are drawn at a fixed size. This size is system-dependent but is typically 16x16 pixels.
Images of greater dimensions are scaled down, images of lesser dimensions are centrally placed but never scaled up.
-th=<num>
Draw a black frame of width <num>
pixels around the image (if -im is present).
-v=<num>
A numeric value (1 or 0) indicating whether the
toggle in the menu option is to be shown as on or off when the menu is
first displayed. The default is 0.
The menu will remain displayed until a valid option is picked, or until a click outside the menu is made.
Pulldown menus may be invoked in one of the following situations:
from a window button procedure (window.buttons)
from a window help procedure (window.help)
from a panel button procedure (panel.exec)
from the system help procedure (help)
but not from within a macro, stanza or function called from one of the above.
When a command_block invoked by a pulldown menu contains another pulldown menu, that command block must contain only the pulldown command and no others. Any other commands present in the command block will not be executed.
Attach a pulldown menu to a button of a graphic window. Another pulldown is attached to a menu within the button procedure.
window grawin = wgraphic grawin.button_labels[2] = 'Zoom/Pan' grawin.buttons[2] { args w=window unless (w.view) { bell; !Cannot do this on a perspective } else { pulldown { 1: 'Blow' { blow -iw=w } 2: 'Shrink' { shrink -iw=w } 3: 'Pan' { # Note: pulldown is the only command in this block pulldown { 1: 'Interactive' { pan -iw=w } 2: 'Left' { pan -iw=w,-l=0.5 } 3: 'Right' { pan -iw=w,-r=0.5 } 4: 'Up' { pan -iw=w,-u=0.5 } } } } } }
Commands: |
|
Identifiers: |
menu_switch (numeric) |
Structures: |