ListBox.IsSelected
The ListBox Control Object that is returned by the AddListBox function has an IsSelected function. The IsSelected function can be used to determine if specific entries are selected.
Syntax |
ControlObject.IsSelected (Index Number) Where ControlObject. is the name of the variable (declared in your script) that is used to store the List Box Control Object that is returned by the AddListBox function. |
Description |
Use to determine whether an option is selected. The IsSelected function returns a Boolean value (True if the option is selected; False if the option is not selected). |
Arguments |
Index Number {integer} A number that corresponds to the position of the option in the List Box (descending order with 0 at the top and the highest number at the bottom of the List Box). |
Returns |
Boolean |
Example:
The IsSelected function can be used with IF statements, so that an action can be performed if a specific option has been selected.
IF ListBox.IsSelected(2) THEN
Where:
- ListBox is the name of the variable used to store the List Box Control Object that is returned by the AddListBox function (which would be defined earlier in the script)
- 2 is the Index Number for the option being checked.
If option 2 is selected, the action that would be defined after THEN would be performed. If option 2 is not selected, another action would be performed (which would be defined after an ELSE function in the script).