Sign in Join
FPDoc Onlineexperiment

TCustomListView.ItemIndex property

Member of TCustomListViewpublicIn unit ComCtrls

Ordinal position for the selected list item on the control.

Declaration

pascal
property 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

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.