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

# TCustomListBox.Selected

The Selected state for an item in the control.

## Declaration

Source position: stdctrls.pp line 678

`public property TCustomListBox.Selected[Index: Integer] : Boolean read GetSelected write SetSelected;`

## Description

Selected is an indexed Boolean property used to set the selection state for an item defined in the list box control.

The index value is the ordinal position in Items with the selection state value. Read and write access for the property value call the CheckIndex method to verify that the index is in bounds for the defined Items in the control. CheckIndex raises an exception if an index value is not in the required range.

Property values are read from the widgetset class when it has been created, or from the cached selection values when it has not. Write access ensures that ItemIndex is updated as needed, and notifies the widgetset class and/or the item selection cache when a value is changed.

Use SelectAll to set the selection state for all Items in the control.

Use SelectRange to set the selection state for Items in the specified range of positions in the control.

Use ClearSelection to reset the selection state for all Items in the list box control.

## See also

TCustomListBox.CheckIndex |  | Ensures that the Item index is within the bounds for the Items in the control.
TCustomListBox.Items |  | The list of all items defined in the control.
TCustomListBox.ItemIndex |  | Ordinal position for the currently selected item, -1 if none.
TCustomListBox.SelectAll |  | Selects all items in the list (in ExtendedSelect mode).
TCustomListBox.SelectRange |  | Changes the selection state for a range of Items in the control.
TCustomListBox.ClearSelection |  | Unselects all items in the control.