Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-10

[PATCH/RFC] DBGrid: allow editing of lookup columns via picklist

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Alexander Klenin

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. -------------- next part -------------- A non-text attachment was scrubbed... Name: dbgrid_lookup_picklist.patch Type: application/octet-stream Size: 2985 bytes Desc: not available Url : http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20081010/bed1461f/attachment.obj

Reply by email

Micha Nelissen
to Alexander Klenin
Alexander Klenin wrote
Attached patch allows user to edit lookup fields in DBGrid, in a manner similar to Delphi.

If no one responds within a few days, please add to the bug tracker so that it won't be forgotten.

Micha

Reply by email

Alexander Klenin
to Micha Nelissen
Micha Nelissen wrote 6 lines
Alexander Klenin wrote: > Attached patch allows user to edit lookup fields in DBGrid, in a > manner similar to Delphi. If no one responds within a few days, please add to the bug tracker so that it won't be forgotten.

Added as http://bugs.freepascal.org/view.php?id=12347

Regardless of acceptance of this patch, I would like to know current policy: If I want to add a feature/fix a bug which requires a change to FPC/FCL, how do I proceed? What kinds of workarounds are acceptable?

Alexander S. Klenin Insight Experts Ltd.

Reply by email

Joost van der Sluis
to Alexander Klenin

Op zaterdag 11-10-2008 om 22:48 uur [tijdzone +1100], schreef Alexander Klenin:

Regardless of acceptance of this patch, I would like to know current policy: If I want to add a feature/fix a bug which requires a change to FPC/FCL, how do I proceed? What kinds of workarounds are acceptable?

Submit the necessary patches to fpc first. If those are comitted into trunk, you can post patches for Lazarus, using {$IFNDEF FPC_2_2_2} (or equivalent) so that it will only work when Lazarus is compiled with a newer fpc-version.

If there is a hack available which is really needed, you could also place that code in an ifdef-block so that it is excluded for newer fpc-versions. But then it must be really important, or the patch will be rejected.

Joost.

Reply by email