Dialog
A dialog is a window which gets input from the user. Operations
support constructing a dialog and getting the user's answers. Dialogs
include two parts: entries (names and types for the fields of user
input) and options (buttons like "okay", which can have associated
callbacks to the application). The create methods construct dialog
entries and options, returning indices which can be used by the set
methods to modify the dialog.
Which types of entries are supported is implementation-dependant; some
possibilities include the following:
- Null: no entry, just a label
- "text n": text entry; the argument is an integer
indicating the number of characters
- "checkbox": true/false box
- "radiobuttons
opt1|opt2|...|optn": select
one of the options
Implementations:
- Dialog_Text
Text-based dialog, for use with UI_Text. Constructor args: Reader,
Writer, string prompt. Supports all entry types.
- Dialog_Tk_File
Browser to get name of file. Constructor args: UI_Tk, string message.
No additional entries allowed.
- Dialog_Tk_Message
Simple message with okay option. Constructor args: UI_Tk, string name.
Supports all entry types.
- Dialog_Tk_Modal
Modal dialog with okay and cancel options. Constructor args: UI_Tk,
string name. Supports all entry types.
- Dialog_Tk_Nonmodal
Nonmodal dialog with okay, cancel, apply, and reset
options. Constructor args: UI_Tk, string name. Supports all entry types.
Member functions:
- create_entry: Dialog . string name . string type=0 -> int
Adds a new entry of the given name and type, returning its index.
Types are discussed above.
- create_option: Dialog . string name . Callback=0 -> int
Adds a new option of the given name and action, returning its index.
- get_entry_*: Dialog . int -> *
Gets the value of the
entry at the given index; versions provided for int, float, boolean,
and string.
- hide: Dialog -> void
Establishes the dialog.
- invoke: Dialog -> void
Hides the dialog.
- num_entries: Dialog -> int
Returns the number of entries.
- num_options: Dialog -> int
Returns the number of options.
- set_default_option: Dialog . int -> void
The
option at the given index will be executed if the user presses "enter."
- set_entry_*: Dialog . int . * -> void
Sets the
value of the entry at the given index to the given value; versions
provided for int, float, boolean, and string.
- set_entry_name: Dialog . int . string -> void
Sets the
name of the entry at the given index.
- set_option_name: Dialog . int . string -> void
Sets the
name of the option at the given index.
- set_option_action: Dialog . int . Callback -> void
Sets the
action of the option at the given index.
Secondary operations:
- clear_entries: Dialog -> void
Clears all entries in
the dialog.