DBGrid PickList lazarus / 16-Databases ---------------------------------------------------------------------- fpcoder · 2014-08-16 22:35 How to make a DBGrid picklist work like DBLookupComboBox? Can the DBGrid picklist be used to store a value other than the display name you select from the picklist? In my case, the picklists should be populated with names from the 'countries' and 'reasons' tables below, but store the integer country_id and reason_id in the 'trips' table. There are two simple tables: 'countries' and 'reasons'. (Just an example). Table 'countries' country_id: integer | country_name: varchar(30) Ex: 1,Sweden 2,Iceland 3,Norway Table 'reasons' reason_id: integer | reason_name: varchar(30) Ex: 1,Vacation 2,Medical 3,Work Trip records will be added to a third table called 'trips' and store country_id and reason_id in it. The 'trips' table looks like this: trip_id: integer (autoincrement) | country_id: integer| reason_id: integer I want to use a DBGrid with PickLists so the user can just click a cell and select country and reason from dropdown lists. Just like a DBLookupComboBox. One solution is to overlay a DBLookupComboBox so it produces this effect, but if its possible to do it with the built in functionality of the DBGrid, then that's the best. So far the DBGrid's PickList seems to work like a DBComboBox and capable of storing only the displayed string, not a value of another field as DBLookupComboBox can. But something tells me its possible, just because it would be useful. ---------------------------------------------------------------------- irfanbagus · 2014-08-17 02:15 it is possible. just create lookup field on 'trip' dataset and hide (visible:= false) 'country_id' and 'reason_id' fields. dbgrid will show DBLookupComboBox like column ---------------------------------------------------------------------- fpcoder · 2014-08-19 02:19 Thanks, I'm working on it. Might have to check in for more hints later. Quote from: irfanbagus on August 17, 2014, 04:15:22 amit is possible. just create lookup field on 'trip' dataset and hide (visible:= false) 'country_id' and 'reason_id' fields. dbgrid will show DBLookupComboBox like column