Search code examples
delphicomboboxrefreshcontrolslivebindings

delphi live bindings filter a combo box


I have 2 combo boxes link to a table looking up values in a type and subtype tables. When the users select the first I need to filter the data in the second.

Example data:

Tables
type     subtype
vehicle  car
vehicle  truck
vehicle  4-wheeler
boat     v-hull
boat     flat-bottom

Before live bindings you could filter and refresh the second data lookup (subtype) on the before popup event of the second or on the close or change event of the first combo box. When I try this using live bindings it has not effect. I also tried to use the Bindlist.Notify method with no success.


Solution

  • I setup an master detail relationship between the main table and the subtype table. When the type was selected it set the value on the main table and filtered the subtype. I toggled the Active property on the LinkFillControlToField it refresh the list.

    procedure TframeEquipmentEdit.cbbSubtypeClassEnter(Sender: TObject);
    var i : integer;
    begin
    LinkFillControlToField10.Active := False;
    LinkFillControlToField10.Active := True;
    end;
    

    Thanks for your comments and help

    Wade