From Lazarus wiki
Revision as of 14:34, 16 December 2012 by BigChimp (talk | contribs) (Need this page to explain "single" vs "double" data bound use)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search



Unit: Lazarus DbCtrls

Official documentation: TDBLookupComboBox


A (doubly) data-bound combobox. The TDBLookupCombobox control gets a list of values from its ListSource (which e.g. represents a table with product info, "Products"). It then

  • displays the values in the ListField (e.g. a "ProductName" field) while
  • remembering the values in the KeyField (e.g. an "ID" field)

The combobox stores the result (i.e. the KeyField value in the DataField, e.g. the "ProductID" field in the DataSource property (e.g. an "Orders" table).

The difference with the TDBComboBox is that the DBComboBox is a (as it were) "singly data bound control": it stores the results in a database fields but the list of values to select from is supplied by code/via the Object Inspector.

Unbound use

You can get the combobox to look up values from a table without storing the results by leaving the DataSource and the KeyField properties empty.