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

TCustomListView.Selected

Contains the selected list item in the list view control.

Declaration

Source position: comctrls.pp line 1656

public property TCustomListView.Selected : TListItem
  read GetSelection
  write SetSelection;

Description

Selected is a TListItem property which contains the selected list item in the list view control. Assign a value from the Items property to select the list item.

When MultiSelect is enabled, Selected represents the first entry in Items that has its Selected property set to True. If none of the list items has its Selected property set to True, or SelCount is 0, the property value is Nil.

When OwnerData (or Virtual Mode) is enabled, Selected refers to the most recent owner data item retrieved when the value in ItemIndex was changed. If the item index was set to -1, the property value is Nil.

Assigning a new value to Selected causes the existing list item in the property to be updated. In single select mode (MultiSelect = False), the Selected property for the list item is set to False prior to clearing or reassigning the property value.

When MultiSelect is enabled, setting a new value for the property causes the list item to be included in the list of multi-selected Items. If the new value is Nil, all of the entries in Items reset their Selected properties to False. In short, setting Selected to Nil clears any existing multi-selections in Items.

Setting a new value for the property causes the OnChange and OnSelectItem event handlers to be signalled (when assigned) when the LVN_ITEMCHANGED notification message is handled for the control.

Use ClearSelection to remove all selections (single or multi-) for the control.

Use SelectAll to select all list items when MultiSelect is enabled.

See also

TCustomListView.OwnerData

  

Enables or disables owner data (virtual) mode for the list view control.

TCustomListView.MultiSelect

  

Allows simultaneous selection of one or more list items using Ctrl+Click, Shift+Click, Ctrl+Shift+Click, or using program code.

TCustomListView.ItemIndex

  

Ordinal position for the selected list item on the control.

TCustomListView.Items

  

Collection of list items displayed on the list view control.

TCustomListView.ClearSelection

  

Clears single or multi-selections in the control.

TCustomListView.SelectAll

  

Selects all Items in the control when MultiSelect has been enabled.

TListItem.Selected

  

Whether this Item has been Selected (often denoted by a check-mark).

TListItems.Count

  

Count - the number of items in the collection.

TOwnerDataListItem.SetDataIndex

  

Sets the internal index position for the virutal item.

The latest version of this document can be found at lazarus-ccr.sourceforge.net.