Displaying and Editing Data in List and Combo Boxes

From RAD Studio
Jump to: navigation, search

Go Up to Displaying a Single Record


There are four data controls that provide the user with a set of default data values to choose from at run time. These are data-aware versions of standard list and combo box controls:

  • Vcl.DBCtrls.TDBListBox, which displays a scrollable list of items from which a user can choose to enter in a data field. A data-aware list box displays a default value for a field in the current record and highlights its corresponding entry in the list. If the current field value of the row is not in the list, no value is highlighted in the list box. When a user selects a list item, the corresponding field value is changed in the underlying dataset.
  • Vcl.DBCtrls.TDBComboBox, which combines the functionality of a data-aware edit control and a drop-down list. At runtime it can display a drop-down list from which a user can pick from a predefined set of values, and it can permit a user to enter an entirely different value.
  • Vcl.DBCtrls.TDBLookupListBox, which behaves like TDBListBox except the list of display items is looked up in another dataset.
  • Vcl.DBCtrls.TDBLookupComboBox, which behaves like TDBComboBox except the list of display items is looked up in another dataset.

The following topics describe these components in more detail:

Note: At runtime, users can use an incremental search to find list box items. When the control has focus, for example, typing 'ROB' selects the first item in the list box beginning with the letters 'ROB'. Typing an additional 'E' selects the first item starting with 'ROBE', such as 'Robert Johnson'. The search is case-insensitive. Backspace and Esc cancel the current search string (but leave the selection intact), as does a two second pause between keystrokes.

See Also