TcxCustomExtLookupComboBox Class
The base class for lookup editors displaying a grid View in the dropdown window.
Declaration
TcxCustomExtLookupComboBox = class(
TcxCustomDBLookupEdit
)
Remarks
This class is the ancestor for lookup editors (TcxExtLookupComboBox and TcxDBExtLookupComboBox), which display grid Views within their dropdown windows. To specify the View for the editor, use its Properties.View property. Only data-aware table and Banded Table Views can be used for this purpose.
A View repository represented by the TcxGridViewRepository component helps you create and customize Views. Do not reuse the same View in your grid control and ExtLookupEditor.
Lookup editors are designed to edit values “indirectly” by picking up a record from the dropdown View. When you select a specific record from the View, this action changes the display text (the Text property) and the edit value (the EditValue property) obtained from the selected record.
The edit value is determined by the record’s Properties.KeyFieldNames field. Moreover, the edit value matches this field value. That is when you modify the EditValue property, the record with the key field matching the edit value is focused and the display text of ExtLookupEditor is changed.
You can specify more than one field in the KeyFieldNames property, in this case the edit value contains an array of variant values.
The display text is obtained from the Properties.ListFieldItem column of the selected record. You cannot modify the text in the edit box. It only helps you to identify the selected record visually.
Data-aware lookup editors are used to edit values from one dataset by selecting a record from another dataset (displayed by the View). The field being edited by a TcxDBExtLookupComboBox control is specified by the editor’s DataBinding.DataField property. The edit value matches the value of the field being edited.
To make a lookup editor work properly, you need to:
Assign a View to the Properties.View property.
Select a View column (the Properties.ListFieldItem property) whose data will be displayed within the edit box of ExtLookupEditor.
For the data-aware ExtLookupEditor, specify the field being edited via the DataBinding.DataField property. This field must match the Properties.KeyFieldNames property.
Specify the key field name(s) via the Properties.KeyFieldNames property to identify records within the dropdown View.