Previous Topic

Next Topic

Inhoudsopgave

Book Index

TDBLookupComboBox Control

TDBLookupComboBox

Description

Represents a combo box that identifies a set of field values in one dataset with a corresponding set of values from another dataset.

Remarks

Use TDBLookupComboBox to provide the user with a convenient drop-down list of lookup items for filling in fields that require data from another dataset.

If TDBLookupComboBox is linked to a lookup field component, it automatically reads the relationship between the field value and the lookup values in the lookup dataset from the field component. The relationship between field values and the corresponding values in the lookup dataset can also be explicitly set using the properties of the lookup combo box when the combo box is not linked to a lookup field component.

TDBLookupComboBox Properties

Property Property DropDownRows: Integer (R/W)

Specifies the number of items displayed in the drop-down list of the TDBLookupComboBox.

Use DropDownRows to specify how many rows appear in the drop down list of the combo box. If there are more lookup items than DropDownRows, the lookup list box displays a scroll bar. The default value for DropDownRows is 7.

Property Property KeyField: String (R/W)

Identifies the field in the ListSource dataset that must match the value of the DataField field. Use KeyField to link the ListSource of the lookup control to the DataSource. Although the name of the field specified as the KeyField does not have to be the same as the name of the field specified as the DataField, the two fields must have the same values. After specifying the ListField, choose which field the lookup control will actually display with the ListField property. If the DataField field is a lookup field, don't specify anything for KeyField or ListField; lookup controls automatically use the data field's LookupKeyFields property for KeyField.

Property Property ListField: String (R/W)

Identifies the field or fields whose values are displayed in the lookup control. The lookup control represents a field in one table by displaying the value of one or more corresponding fields in another table. ListField is the name of the field or fields in the lookup table that are actually displayed, as opposed to the DataField, which is the field in the DataSource that the lookup control actually represents, or the KeyField, which is the field in the lookup table with the same value as the DataField. To fully specify the list fields, both a dataset for the lookup table and the fields within that dataset must be defined. The ListSource property of the lookup control specifies the dataset for the lookup table. ListField can represent more than one field. Separate multiple field names with semicolons. Before specifying ListField, specify the link between the two datasets using the KeyField property. If ListField is not set, lookup controls display KeyField field values by default. If the DataField field is a lookup field, don't specify anything for ListField; the data controls automatically use the lookup field's LookupResultField property as ListField.

Property Property ListFieldIndex: Integer (R/W)

Specifies which field from the ListField property is used for incremental searching.

When the ListField property specifies more than one field, use ListFieldIndex to specify which of those fields is the one to use for incremental searches. For the DBLookupComboBox object, ListFieldIndex also determines which field appears in the edit region of the combo box. ListFieldIndex allows the most important value to appear in a position other than the first when all the values of the ListField fields are displayed. The value of ListFieldIndex must be less than the number of fields specified by the ListField property.

General Data-Aware Control Properties

Property Property DataField: String (R/W)

Property Property DataSource: TDataSource (R/W)

Property Property ReadOnly: Boolean (R/W)