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

# TCustomListBox.SelectRange

Changes the selection state for a range of Items in the control.

## Declaration

Source position: stdctrls.pp line 629

`public procedure TCustomListBox.SelectRange(`
`ALow: Integer;`
`AHigh: Integer;`
`ASelected: Boolean`
`); virtual;`

## Arguments

`ALow` |  | Ordinal position for the initial item changed in the method.
`AHigh` |  | Ordinal position for the final item changed in the method.
`ASelected` |  | True if the items are selected; False when they are unselected.

## Description

SelectRange is a procedure used to change the selection state for a range of Items in the list box control to the value specified in ASelected.

ALow and AHigh contain the ordinal positions in Items affected in the method. ALow must be a positive integer value or zero (0). AHigh must be less than the value in the Count property for Items. When either value is out of range, no actions are performed in the method.

When MultiSelect is set to True, the widgetset class is notified of the changes to item selection state and DoSelectionChange is called to trigger the OnSelectionChange event handler (when assigned). No actions are performed in the method when MultiSelect is set to False.

SelectRange is similar to the SelectAll method, but limits the affected items to the specified range of values - and only when MultiSelect is enabled.

Use SelCount to determine the number of Items selected in the control when MultiSelect is enabled.

Use Selected to maintain the selection state for a single entry in the Items property.

## See also

TCustomListBox.Items |  | The list of all items defined in the control.
TCustomListBox.SelectAll |  | Selects all items in the list (in ExtendedSelect mode).
TCustomListBox.DoSelectionChange |  | Signals the OnSelectionChange handler.
TCustomListBox.OnSelectionChange |  | Handler invoked when an item is selected in the control.
TCustomListBox.ClickOnSelChange |  | Allows selection changes to generate a Click event.
TCustomListBox.Selected |  | The Selected state for an item in the control.
TCustomListBox.SelCount |  | The number of selected items in the list box control.