I’m loading a combo box with a number of customer records (3000+) (Delphi Alexandria/Firemonkey). Traditionally I’ve done this by creating an object with the ID number of the record and the identifying text:
IDRec := TIDRecClass.Create;
IDRec.IDNum := FieldByName(‘CustID’).AsInteger;
cboProducts.Items.AddObject (FieldByName(‘CustomerName’).AsString, IDRec);
and fetching the ID by retrieving the object when the combo box changes, but performance for loading the records was slower than I liked, so I though I would try a Live Binding (I’ve never used Live Binding before so I am a total newbie.) I bound the component to a table by selecting LiveBinding -> Bind Visually from the list of properties and connecting the CustID to the SelectedValue and the CustomerName to the Item.Text.
It loads the Customers quickly, but I have two issues now. First, it appears that when I select an entry, the OnChange event of the combo box does not fire, and second I’m not clear how to get the CustID number from the component for the selected entry. Once the record has been selected I need to use the CustID to fetch additional data from other tables.
All of the examples of how to work with live bindings seem to bind all of the controls on the form, and that’s not what I’m looking to do. Is there a resource I can use to learn how to do this? (Or a solution I can copy?)