ItemIndex Property

Applies to TestComplete 15.45, last modified on December 01, 2022

Specifies the index of the selected item.

Declaration

componentObj.ItemIndex
Read-Write Property Integer
componentObj     One of the user forms components and objects listed in the Applies To section  

Applies To

This property applies to the following components and objects:

TcxComboBox, TcxListBox, TcxRadioGroup

Description

Use the ItemIndex property to obtain or specify the index of the item currently selected in the component. Setting the property value changes the selection.

Note: For TcxListBox components, the ItemIndex property is not displayed among other properties in the User Forms editor. However, it is available in scripts and dispalyed in the Code Completion window.

Property Value

An integer value that specifies the index of the currently selected item. The index of the first item is 0, the index of the second item is 1 and so on. To get the total number of items, use the Items.Count property.

The default value is -1; it means that no item is selected.

Remarks

For TcxListBox components that support multiple selection (that is, whose MultiSelect property is True), the ItemIndex property specifies the index of the item that was focused last, whether is was selected or unselected. In this case, setting the ItemIndex property does not change the selection. To get or set selected items in a multi-selectable TcxListBox component, use the Selected and SelCount properties.

See Also

Items Property
TcxRadioGroupItems.Count
TStrings.Count
MultiSelect Property
SelCount Property
Selected Property

Highlight search results