Combo Box Control Syntax

Syntax

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

Note: You must not have any space characters in the finished command, except those that may be inside entries in the Choices list.

Argument

Type

Description

[ ^+ ]

C

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

N

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

N

Optional. The width of the control.
Variable_Name

C

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

C

See Choices Syntax.
Event

C

Optional. See Event Syntax.
Enabled

L

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.

Note: 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: [Picture]

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

Xdialog Language Directives and Operators, Xdialog Control Reference

Supported By

Alpha Five Version 5 and Above