Skip to main content

TdxBarLookupCombo Example

This example shows how to use a TdxBarLookupCombo for record filtering. For instance, you have two datasets: VENDORS and PARTS. One record from VENDORS corresponds to several records in PARTS. Using the TdxBarLookupCombo you can get a list of all parts belonging to the vendor. You can set its ListSource property to the data source, which specifies vendors, and handle the TdxBarLookupCombo.OnChange event as shown in the code snippet below. The Datasource2.Dataset specifies the PARTS dataset.

procedure TForm1.dxBarLookupCombo1Change(Sender: TObject);
begin
  Datasource2.Dataset.Filter :=
    dxBarLookupCombo1.KeyField + ' = ' + VarToStr(dxBarLookupCombo1.KeyValue);
  Datasource2.Dataset.Filtered := True;
end;