Getting Started | Documentation | Glish | Learn More | Programming | Contact Us |
Version 1.9 Build 1556 |
|
Package | display | |
Module | guiutils |
include "choice.g"
Choice is used to have the user select one of several strings. It puts up a gui box with some descriptive text, and a button for each choice. A default choice can be indicated. When left unset, the the first choice is the default. The default is used if it is not possible to put up a GUI or a timeout occurs.
This function is used by the tasking system, but might be of use to people writing their own scripts.
The types, when specified, should be chosen from those known to the widgetserver. These include ``plain'', ``action'', ``halt'', and ``dismiss''. When types is unset (its default value) all buttons will be ``plain''.
When a default is specified, it indicates which element of choices is returned when no GUI can be displayed or a timeout occurs.
description | Descriptive text for the choices | ||
Allowed: | string | ||
choices | One of these choices will be returned | ||
Allowed: | string array | ||
types | Button types for choices | ||
Allowed: | string array | ||
Default: | unset | ||
default | Which choice is the default one | ||
Allowed: | integer | ||
Default: | 1 | ||
interactive | If interactive, use a GUI, otherwise return the first choice. | ||
Allowed: | boolean | ||
timeout | How long to wait for the user to respond | ||
Allowed: | integer | ||
widgetset | Which widgetserver to use | ||
Allowed: | widgetserver | ||
Default: | dws |
# all plain buttons, default choice is no result := choice('Do you want to quit?', ['no', 'yes']) if (result == 'yes') {print 'Bye!'; exit; };
# halt and dismiss button types, choice is yes result := choice('Do you want to quit?', ['no', 'yes'], ['dismiss', 'halt'], 2) if (result == 'yes') {print 'Bye!'; exit;};