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

# TCustomListBox.DoSelectionChange

Signals the OnSelectionChange handler.

## Declaration

Source position: stdctrls.pp line 608

`protected procedure TCustomListBox.DoSelectionChange(`
`User: Boolean`
`); virtual;`

## Arguments

`User` |  | True when the selection change results from user interaction with the control.

## Description

DoSelectionChange performs actions needed when the selected item in the list box control has been changed. DoSelectionChange signals the OnSelectionChange event handler (when assigned).

User indicates if the selection was changed as a result of user interaction with the control, as opposed to a change performed in code at run-time. When User is set to True, and ClickOnSelChange is enabled, an internal flag is set to prevent execution of the method by a subsequent mouse click.

DoSelectionChange is called when the LM_SelChange message is handled for the control, and when a new value is assigned to the ItemIndex property. User is set to False when the selection change is caused by setting a new value in ItemIndex.

## See also

TCustomListBox.OnSelectionChange |  | Handler invoked when an item is selected in the control.
TCustomListBox.ItemIndex |  | Ordinal position for the currently selected item, -1 if none.
TCustomListBox.ClickOnSelChange |  | Allows selection changes to generate a Click event.