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

# TDBLookupListBox.DoSelectionChange

Performs actions needed when the selected item in the listbox is changed.

## Declaration

Source position: dbctrls.pp line 484

`protected procedure TDBLookupListBox.DoSelectionChange(`
`User: Boolean`
`); override;`

## Arguments

`User` |  | Indicates if the selection change is due to user interaction with the control.

## Description

DoSelectionChange is an overridden method in TDBLookupListBox. It extends the inherited method to provide support for the "unbound" usage model where either the DataField or the DataSource is not defined for the control. This allows the lookup dataset to be synchronized to the current item selection in the listbox, but does not include storing the new value in the linked dataset.

User indicates if the selection change is a result of user interaction with the listbox control, as opposed to a programmatic change from methods or messages in the class. When both User and IsUnbound are True, the UpdateData method is called to reposition the lookup dataset to the new value for the control.

When User is True and IsUnbound is False, the internal TFieldDataLink is notified of the new value by calling its CanModify, Modified, and UpdateRecord methods. If the linked dataset cannot be modified, the DataChange method is called.

DoSelectionChange calls the inherited method prior to exit.

## See also

TDBLookupListBox.DataField |  | Name for the field in the linked dataset used in the control.
TDBLookupListBox.DataSource |  | Provides access to the linked dataset for the control.
TDBLookupListBox.IsUnbound |  | Indicates if the control is being used in the "unbound" mode.
TDBLookupListBox.DataChange |  | Performs actions needed when a new DataField value is selected using the lookup dataset.
TFieldDataLink.CanModify |  | True if the linked field is capable of being modified.
TFieldDataLink.Modified |  | Updates the class when the linked dataset enters an edit state.
TDataLink.UpdateRecord
TCustomListBox.DoSelectionChange |  | Signals the OnSelectionChange handler.
TCustomListBox.ItemIndex |  | Ordinal position for the currently selected item, -1 if none.