GetSelectedIndex
Definition:
GetSelectedIndex(control)
Description:
Determine the currently selected item in a Combo Box, List Box or ListView Control.
Platforms:
All
Parameters:
control - required
Name of the control whose selected item you want to know about.
Returns:
integer
The index of the currently selected item. The first item has an index value of zero, 0.
-1
No item selected.
Notes:
-
With Combo Boxes and List Boxes, on the Windows Desktop and Windows Universal Platforms when the control is populated the first item in the list will automatically be selected, on iOS and Android devices no item is selected. This means that calling GetSelectedIndex for a Combo Box or List Box before a user has actually made a selection would return 0 on Windows devices but -1 on Apple or Android devices.
-
With ListView Controls, the currently selected row is automatically set to be the current record, you do not need to call SelectRecord.
Note that if the Show Selection in Touch Mode Property for this control is set to False, the currently selected row within a ListView will not be highlighted on the actual display.
-
For Dropdown Combo boxes the index returned will be -1 if the value in the Edit Box doesn't match any of the predefined values in the list.