Defines a list box selection field.

dlgListBox(string array[], int &Selected) [ statement ]

The dlgListBox statement defines a list box selection field with the contents of the given array.

Selected reflects the index of the selected list box entry. The first entry has index 0.

Each element of array defines the contents of one line in the list box. None of the strings in array may be empty (if there is an empty string, all strings after and including that one will be dropped).

The optional statement is executed whenever the user double clicks on an entry of the dlgListBox.
Before the statement is executed, all variables that have been used with dialog objects are updated to their current values, and any changes made to these variables inside the statement will be reflected in the dialog when the statement returns.

If the initial value of Selected is outside the range of the array indexes, no entry will be selected.

See also dlgComboBox, dlgListView, dlgLabel, Layout Information, A Complete Example


string Colors[] = { "red", "green", "blue", "yellow" };
int Selected = 2; // initially selects "blue"
dlgListBox(Colors, Selected) dlgMessageBox("You have selected " + Colors[Selected]);

Index Copyright © 2005 CadSoft Computer GmbH