HTBasic Help
×
Menu
Index

DIALOG

Generates a dialog of the specified type
 

Example

DIALOG "WARNING","Reactor Meltdown Imminent",Btn;SET ("BACKGROUND":2)
DIALOG "STRING","Enter your Operator ID:";RETURN ("VALUE":Resp$),TIMEOUT 10
 
DIM Speeds$(0:2)[20]
Speeds$(1)="Slow"
DIALOG "LIST","Pick your speed:",Btn;SET ("WIDTH":250,"HEIGHT":80,"ITEMS":Speeds$(*)), RETURN (SELECTION":Resp)
 

Syntax

 
DIALOG dialog_type, prompt_str, selected_btn [; { SET (set_atr_list ) | RETURN ( ret_atr_list) | TIMEOUT timeout_val ] [, ...] 
  set_atr_list =  { sstr_exp: { num_exp | str_exp } | mstr_exp:{num_ary | str_ary} | atr_ary(*):{num_ary | str_ary}(*) } [, ...]
  ret_atr_list =  { sstr_exp: { num_exp | str_exp } | mstr_exp:{num_ary | str_ary} | atr_ary(*):{num_ary | str_ary}(*) } [, ...]
 
Item
 Description
 Range *depends on
atr_ary
single-valued array attributes: accompanying
num_ary or str_ary must have identical dimensions
*widget
num_ary
numeric array of attribute values
*attribute(s)
num_exp
numeric expression attribute value
*attribute
sstr_exp
single-valued string expression attribute
*widget
str_ary
string array of attribute values
*attribute(s)
str_exp
string expression containing attribute value
*attribute
mstr_exp
multi-valued string expression of attribute values
*widget
w_hndl
widget handle name (string expression)
any valid name
w_type
widget type string expression
 

Description

You create a DIALOG from a PANEL widget that contains a prompt string, a single widget, and some button widgets.
 

Types of Dialogs

Dialog
Description
Used to enter a string from either an existing list or a string entry field
Use to display an error message and halt program execution until the operator acknowledges the error
Prompts the operator to select a file name from a list of file names
Used to display a piece of information and halt program execution until the operator acknowledges the information
Used to enter numbers from a keypad
Prompts the operator to select an item or set of items from a list of items
Prompts the operator to enter a number into a panel
Used to prompt the operator with a question and halt program execution until the operator answers the question
Used to prompt the operator for information that the programmer needs to use within the BASIC program
Used to display a warning message and halt program execution until the operator acknowledges the warning
 

DIALOG 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. Use the DEFAULT BUTTON attribute to specify one of these buttons as the default button,. 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, the DIALOG will return theindex number of the button pressed or -1 to indicate a timeout occurred. The DIALOG BUTTONS array is always treated as base 0 regardless of how it was dimensioned.
 

SET Option

The SET option specifies the initial values for the attributes and 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 includes 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, you can find out what the user typed into a STRING dialog from the RETURN 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 a common practice when the dialog's purpose is to allow the user to modify an existing quantity. If you use the same variable in the RETURN attribute list, the user's modification will change the program variable.
 

TIMEOUT Option

TIMEOUT will wait 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 (and -1 for the selected button) into the variables specified in return attribute list, and then dismiss (destroy) the dialog.