Open up our MainDemo included with FirePower, and then open the form LookupDialogDemo. Once there look at the configuration of the TwwLookupComboEdit on this form for an example of its usage.
1. Use the Bindings manager to bind the LookupValue property of the LookupComboEdit to the field in your table that should be updated when you make a selection. In this case it is the Zip field in the Customer table.
2. Set the properties of the LookupComboEdit
a) Set the lookupsource to your lookuptable (FDZip's BindSource)
b) Set your lookupfield to the id field in your lookuptable (Zip field)
c) Dbl-click the LookupComboEdit to customize which fields are displayed when the combo is dropped down. The first field is the field that is displayed when it is not dropped down.
Using in a TwwDataGrid
If you are using the LookupComboEdit in the grid and you instead want the grid to display descriptive text from the lookuptable instead of the coded field, then you will additionally need to create a lookupfield in your FillTable that shows the descriptive text. See the Delphi documentation on how to create a lookupfield in your dataset. Then select this newly created lookupfield as a displayed field in your grid. Run your program first to be sure your grid is displaying the descriptive text in the grid. After you have successfully configured the grid, then attach the a TwwLookupComboEdit as a customcontrol to this column. You may want to test out your lookupcomboedit first
Please sign in to leave a comment.