[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'ComCtrls' (#lcl)

# TCustomListView.ItemIndex

Ordinal position for the selected list item on the control.

## Declaration

Source position: comctrls.pp line 1675

`public property TCustomListView.ItemIndex : Integer read GetItemIndex write SetItemIndex;`

## Description

ItemIndex is an Integer property which contains the ordinal position for the selected item on the list view control.

When OwnerData is False, the property value contains the value received from the widgetset class when the LVN_ITEMCHANGED notification message is handled for the control. If OwnerData is True, an internal member is locally maintained to track the selected item. In OwnerData (virtual) mode, only the most recently accessed item is stored for the control.

Setting a new value for the property causes the Selected property to be updated. In OwnerData mode, this causes the internal member to be updated and the virtual item is retrieved to set its Selected property to True. If Virtual mode is not enabled, the Selected property is set to corresponding value in Items.

If the new property value is -1, the value in Selected is set to Nil. Setting a new property value when MultiSelect is enabled also causes Selected to be set to Nil.

An Exception is raised if the new property value is not a value index position in Items, or -1.

## See also

TCustomListView.Selected |  | Contains the selected list item in the list view control.
TCustomListView.Items |  | Collection of list items displayed on the list view control.
TCustomListView.OwnerData |  | Enables or disables owner data (virtual) mode for the list view control.