choice%
Implements: list-control<%>
A choice item allows the user to select one string item from a pop-up list of items. Unlike a list box, only the currently selection is visible until the user pops-up the menu of choices.
Whenever the selection of a choice item is changed by the user, the choice item's callback procedure is invoked. A callback procedure is provided as an initialization argument when each choice item is created.
See also
list-box%.
( -> instantiate choice% () (label _) (choices _) (parent _) (callback _) [(style _)] [(enabled _)] [(vert-margin _)] [(horiz-margin _)] [(min-width _)] [(min-height _)] [(stretchable-width _)] [(stretchable-height _)])choice% object
label : string (up to 200 characters) or #f
choices : list of strings (up to 200 characters each)
parent : frame%, dialog%, panel%, or pane% object
callback : procedure of two arguments: a choice% object and a control-event% object
style = : an empty list of symbols
null
enabled = : boolean
#t
vert-margin = : exact integer in [0, 1000]
2
horiz-margin = : exact integer in [0, 1000]
2
min-width = : exact integer in [0, 10000]
0
min-height = : exact integer in [0, 10000]
0
stretchable-width = : boolean
#f
stretchable-height = : boolean#f
Creates a choice item. If label is a string, it is used as the
label for the choice item.
If an ampersand (``&'') occurs in label, it
is specially parsed; under Windows and X, the character following an
ampersand is underlined in the displayed control to indicate a
keyboard mnemonic. (Under Mac OS, mnemonic underlines are not shown.)
The underlined mnemonic character must be a letter or a digit. The
user can move the keyboard focus to the choice item by typing the mnemonic when the control's
top-level-window contains the keyboard focus. The user must also hold
down the Meta or Alt key if the keyboard focus is currently in a
control that handles normal alphanumeric input. The ampersand itself
is removed from label before it is displayed for the control; a
double-ampersand in label is converted to a single ampersand
(with no mnemonic underlining). Mnemonic keyboard events are handled
by on-traverse-char (but not under
Mac OS).
The choices list specifies the initial list of user-selectable
items for the control. The initial set of choices determines the
control's minimum graphical width (see Geometry Management for more
information).
The callback procedure is called (with the event type
'choice) when the user selects a choice item (or
re-selects the currently selected item).
The style argument is provided for future extensions. Currently, style must be the empty list.
For information about the
enabled
argument, see window<%>. For information about the
horiz-margin and vert-margin
arguments, see subarea<%>. For information about the
min-width, min-height, stretchable-width, and stretchable-height
arguments, see area<%>.
All Methods
accept-drop-files from window<%>
append from list-control<%>
clear from list-control<%>
client->screen from window<%>
command from control<%>
enable from window<%>
find-string from list-control<%>
focus from window<%>
get-client-size from window<%>
get-cursor from window<%>
get-graphical-min-size from area<%>
get-height from window<%>
get-label from window<%>
get-number from list-control<%>
get-parent from area<%>
get-plain-label from window<%>
get-selection from list-control<%>
get-size from window<%>
get-string from list-control<%>
get-string-selection from list-control<%>
get-top-level-window from area<%>
get-width from window<%>
get-x from window<%>
get-y from window<%>
has-focus? from window<%>
horiz-margin from subarea<%>
is-enabled? from window<%>
is-shown? from window<%>
min-height from area<%>
min-width from area<%>
on-drop-file from window<%>
on-focus from window<%>
on-move from window<%>
on-size from window<%>
on-subwindow-char from window<%>
on-subwindow-event from window<%>
on-superwindow-enable from window<%>
on-superwindow-show from window<%>
popup-menu from window<%>
refresh from window<%>
screen->client from window<%>
set-cursor from window<%>
set-label from window<%>
set-selection from list-control<%>
set-string-selection from list-control<%>
show from window<%>
stretchable-height from area<%>
stretchable-width from area<%>
vert-margin from subarea<%>