Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: donechoice - Function Up: guiutils - Module Previous: guiutils - Module


choice - Function



Package display
Module guiutils


Have a user select one of a number of choices


Synopsis
choice(description, choices, types, default, interactive, timeout, widgetset)

include "choice.g"



Description

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.



Arguments

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


Returns
string



Example
# all plain buttons, default choice is no
result := choice('Do you want to quit?', ['no', 'yes'])
if (result == 'yes') {print 'Bye!'; exit; };



Example
# 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;};





next up previous contents index
Next: donechoice - Function Up: guiutils - Module Previous: guiutils - Module   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15