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

# TCustomListBox.OnSelectionChange

Handler invoked when an item is selected in the control.

## Declaration

Source position: stdctrls.pp line 668

`public property TCustomListBox.OnSelectionChange : TSelectionChangeEvent read FOnSelectionChange write FOnSelectionChange;`

## Description

OnSelectionChange is a TSelectionChangeEvent property with the event handler signalled when an item selection on the control has been changed. OnSelectionChange is signalled (when assigned) from the DoSelectionChange method, and occurs prior to calling the Click method for the control.

The User argument indicates whether the selection change results from user interaction with the control (True), or from code or methods called at run-time (False).

Remark: | On the Windows platform, OnSelectionChange is signalled when the user clicks on a list item that is already selected. It is also signalled when a mouse click occurs on an unused area on the list box control. These behaviors are built in to the native control on the platform, and are not configurable.

Use OnClick to perform actions when the mouse is clicked on an item on the list box control.

Use ClickOnSelChange to indicate whether Click / OnClick are called when the left mouse button is released during a click action or when OnSelectionChanged is performed for the control.

## See also

TCustomListBox.DoSelectionChange |  | Signals the OnSelectionChange handler.
TCustomListBox.Click |  | Performs the Changed method when the control is clicked.
TCustomListBox.OnClick |  | Notification handler for mouse clicks.
TCustomListBox.ClickOnSelChange |  | Allows selection changes to generate a Click event.
TCustomListBox.SelectRange |  | Changes the selection state for a range of Items in the control.
TCustomListBox.MultiSelect |  | Allows selection of more than one item from the list.