DIALOG
Creates GUI Dialog of the specified type.
Description:
One of the fundamental HTBasic Plus entities. A dialog is created on the computer screen with the DIALOG statement from an executing BASIC program or from the command line.
The DIALOG statement is a shortcut method for requesting input from the operator. The DIALOG statement functions in a similar fashion to the INPUT and LINPUT statements by collecting operator input without using more complex statements.
Using the DIALOG statement, you can perform the functional equivalent of the following (lengthier) process that would otherwise require more statements.
1. You create a PANEL widget that contains a prompt string, a single widget, and some button widgets.
2. You interact with the contained widget.
3. Then, when you "press" one of the buttons, the system destroys all of the widgets that make up the "dialog PANEL" after passing the selected values from each of the widgets into the variables you have specified.
Types of Dialogs
The types of dialogs that may be created with the DIALOG statement are: COMBO, ERROR, FILE, INFORMATION, KEYPAD, LIST, NUMBER, QUESTION, STRING, and WARNING.
DIALOG/DEFAULT BUTTONS
Use the DIALOG BUTTONS attribute to create the buttons in the dialog. These buttons appear in a single row at the bottom of the dialog, in the same order (left to right on the screen) in which they appear in the attribute array.
To specify one of these buttons as the default button, use the DEFAULT BUTTON attribute. Both DIALOG BUTTONS and DEFAULT BUTTON have different default values, depending on the type of dialog created.
selected button Option
If you specify the optional variable for selected button, when the DIALOG statement completes, the variable will contain: an index into the DIALOG BUTTONS array that identifies which button the user pushed to terminate the dialog, or a –1, indicating a timeout has occurred.
The DIALOG BUTTONS array is always treated as OPTION BASE 0, regardless of how it was dimensioned.
SET Option
The SET option is used to specify the initial values for the attributes and to specify the initial values to be displayed by the contained widget (for example, the contents of the STRING widget in the STRING Dialog).
RETURN Option
The RETURN option is used to specify the variables that will receive the final values of the dialog attributes just before the dialog is destroyed. These variables are used primarily to communicate the state of the contained widget back to the program when the user terminates the dialog. For example, to find out what the user typed into a STRING dialog, you should RETURN the VALUE attribute to a string variable in your program.
Specifying the same variable for the same attribute in both the SET and RETURN attribute lists is acceptable, and in fact will be a common practice when the dialog’s purpose is to allow the user to modify an existing quantity. For this purpose, you should supply the existing value in the SET attribute list and use the same variable in the RETURN attribute list so the user’s modification will change the program variable.
TIMEOUT Option
If you specify the TIMEOUT option in the DIALOG statement, the program will wait only the specified number of seconds for user input before continuing. If the user does not push a button in the dialog within the allotted time, the DIALOG statement will:
•Copy the current state of the dialog attributes into the variables specified in return attribute list.
•Destroy the dialog.
•Return a selected button value of –1, if the optional variable that will receive this value has been specified.
See Also: