List Box (Single Field Single Column) Control Syntax

Syntax

[[%Directives%].Width["][,Height["]]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

%Directives%

 

Refer to Xdialog Language Directives and Operators.
[ ^# ]

C

The leading [ and trailing ] and the ^# characters are required..
Width

N

The width of the control.
Height

N

The height 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. You must either use the use {DATA} command or the K Directive to preserve the formatting of selected items.
Event

C

Optional. See Event Syntax.
Enabled

L

Optional. See Enabled Syntax. The control is grayed out when disabled.

Description

One or more List Box objects may appear inside the Format section of a UI_DLG_BOX() function. To clear or repopulate a list box, simply redefine its Choices variable.

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

Example

For example, the following script creates a list box ten characters wide and five lines tall: [Picture]

mode = 1

choices = <<%dlg%

Shared

Read only

Exclusive

%dlg%

result=ui_dlg_box("Title",<<%dlg%

Filename:| [.32filename];

Open as:;

Mode:| [.10,5mode^#choices];

<OK>

%dlg% )

You can also use an array of character variables to populate the list box.

dim mode as N

dim choices[3] as C

choices[1] = "Shared"

choices[2] = "Read only"

choices[3] = "Exclusive"

mode = 1

result=ui_dlg_box("Title",<<%dlg%

Filename:| [.32filename];

Open as:;

Mode:| [.10,5mode^#choices];

<OK>

%dlg% )

This approach produces the same result. Note the uses of the \ (Backslash) character to distinguish between the "]" in the choices[] variable and the list box syntax.

dim mode as N

dim choices[3] as P

choices[1].mode = "Shared"

choices[2].mode = "Read only"

choices[3].mode = "Exclusive"

mode = 1

result=ui_dlg_box("Title",<<%dlg%

Filename:| [.32filename];

Open as:;

Mode:| [.10,5mode^#choices[\].mode];

<OK>

%dlg% )

See Also

Xdialog Language Directives and Operators, Xdialog Control Reference

Supported By

Alpha Five Version 5 and Above