List Box (Drop-down) Control Syntax

Syntax

[ [ Max_Chars ][. Width [ " ]] Variable_Name ^= Choices [ ! Event ][ ? Enabled ] ]

Arguments

[ ^= ]

Character. Indicates that this is an drop-down list box.

Max_Chars

Numeric. Optional. Default = "" (No limit). The maximum number of characters that will be returned.

Width

Numeric. Optional. The width of the field.

Variable_Name

Character. The name of a character variable to receive the user selection, or a numeric variable to receive the index value of the selected radio button. The index of the top-most button is 1.

Choices

Character. See Choices Syntax.

Event

Character. Optional. See Event Syntax.

Enabled

Logical. Optional. See Enabled Syntax.

Description

The value of Variable_Name is a base-1 index if the variable is declared as Numeric. If undeclared or left un-initialized, the variable is a string that returns the text of the choice that is selected.

You must have an Event if you want to process the user's selection in the Code section of the dialog box.

Example

The following script demonstrates a combo box in which the choices are explicitly stated by enclosing the choices between the '{' and '}' characters.

mode = "Shared"
result=ui_dlg_box("Title",<<%dlg%
Filename:| [.32filename];
Open as:;
Mode:| [.10 mode^={Shared,Read only,Exclusive}];

%dlg% )

This script creates this dialog:

images/XD_combo_box.gif

The following script is identical to the previous script, except that the choices displayed by the combo box come from a variable, which contains a CR-LF delimited list of choices. In addition, mode is declared as a numeric variable. Therefore, the dialog box will set its value to 1, 2, or 3.

mode = 1
choices = <<%dlg%
Shared
Read only
Exclusive
%dlg%
result=ui_dlg_box("Title",<<%dlg%
Filename:| [.32filename];
Open as:;
Mode:| [.10 mode^=choices];

%dlg% )

See Also