Attached patch allows user to edit lookup fields in DBGrid, in a
manner similar to Delphi.

However, it has some problems/limitations, so please review:
1) The patch contains an ugly hack to access TLookupList's internal
representation.
It is, of course, much cleaner to modify the TLookupList definition,
but such a change would increase FPC version requirement, which is
IIUC unacceptable.
What is the current protocol of introducing such changes in Lazarus?

2) It works only for the case of LookupCache = true.
Uncached lookups could be added easily enough, but I am afraid the
performance will suffer.
Anyway, this may be decided later and separately.

3) The selection of LookupKey value depends on uniqueness of
LookupResultField's value.
If there are few records with the same LookupResultField, first one is picked.
This problem is hard to avoid, since user can simply enter
LookupResult value into the field
instead of picking it from the list.
Anyway, duplicated LookupResults if IMO a developer's mistake, so this
is not too important.



-- 
Alexander S. Klenin
Insight Experts Ltd.

Attachment: dbgrid_lookup_picklist.patch
Description: Binary data

_______________________________________________
Lazarus mailing list
[email protected]
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to