Class
SLListBox class
Action
Selects the given list box item.
Syntax
listBox.Select(item, [modifiers])
Variable |
Description |
item |
The name or index of the item to select. LISTITEM. |
modifiers |
Optional.The modifier keys (Alt, Shift and Ctrl) to press while selecting an item. Default: Don't use modifier keys. MODIFIERKEYSTATE. |
Examples
In order to select the item with the text "item 1" from a list box type:
listBox.Select("item 1")
In order to select the third item from a list box type:
listBox.Select(3)
In order to select multiple items a list box use modifier keys (such as Ctrl or Shift).
For selecting both the items with the text "item 1" and "item 3" in a multi-select list box (that has the extended selection
style), type the following:
listBox.Select("item 1")
listBox.Select("item 3", MOD_CTRL)
In a multi-select list box with the multiple selection style a user can deselect a selected item by clicking on it.
The following code selects two items in such a list box and then deselects the first one.
listBox.Select("item 1")
listBox.Select("item 3")
listBox.Select("item 1") ' deselects "item 1"