Combo Box Control Syntax

Syntax

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

Arguments

^+

Character. Indicates that this is an edit combo box that will show the nearest matching value based on the characters typed in.

Max_Chars

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

Width

Numeric. Optional. The width of the control.

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. The control is grayed out when disabled.

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 not have any space characters in the finished command, except those that may be inside entries in the Choices list.
You must have an Event if you want to respond to the user's selection in the Code section of the dialog box.

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}];
<OK>
%dlg% )

This script creates this dialog:

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, 3, or whatever the user enters.

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

See Also