Is there a database component allowing for navigating through an attached dataset with a combobox look & feel? Upon setting the DataSource
, a specifiable field would be 'loaded' into the Items
property, and when the user selects an item, the dataset navigates to the selected record. Does such a component exist?
1 Answer
You can achieve this with a TDBLookupComboBox
omitting the DataSource
and DataField
property. You have to link the ListSource
to your actual data source, the KeyField
to the field used for the order and the ListField
to the field(s) to be displayed.
-
-
Hmm - yes, the data gets loaded, but navigation doesn't happen when I select an item. Furthermore, after loading, the current item does not show as text...– tuaNov 19 at 17:50
-
Can you explain your expectations in more detail? I have no problem to achieve what you describe in your question. I connected a TDBGrid to the same DataSource as the combobox ListSource and each selection moves the current grid row to the selected record. Nov 19 at 17:58
-
@UweRaabe he wants to navigate a database based on what's selected in the ComboBox. Tua: you will need to use an event of the TDBLookupComboBox to navigate, such as TDBLookupComboBox.OnCloseUp, check the TDBLookupComboBox.KeyValue and use that value to navigate. Nov 19 at 21:09
-
TComboBox
and handle the DB potion manually. Query the DB for the desired field and add the found items to the list. Then when an item is selected, query the DB for the desired record using the selected item.