[Lazarus] TDBGrid

Jesus Reyes jesusrmx at yahoo.com.mx
Tue Aug 24 22:57:05 CEST 2010



--- El sáb 21-ago-10, Bernd Kreuss <prof7bit at googlemail.com> escribió:

> De: Bernd Kreuss <prof7bit at googlemail.com>
> Asunto: Re: [Lazarus] TDBGrid
> A: Lazarus at lists.lazarus.freepascal.org
> Fecha: sábado, 21 de agosto de 2010, 15:54
> On 21.08.2010 18:03, Bernd Kreuss
> wrote:
> > On 21.08.2010 16:02, Bernd Kreuss wrote:

[snip]

> it shows that whenever I have entered data and press enter
> or move away
> from that cell using the arrow keys the DBGrid is in a
> state where it
> does not have the focus anymore. But it also *wont* trigger
> the OnExit
> event! Using the arrow up/down some more times will
> eventually give it
> focus again so I can continue.
> 
> Forcing the focus back with SetFocus seems to work but I
> don't like this
> workaround. Also in unpatched LCL there is no OnEditingDone
> for the
> TDBGrid for some reason and also no other event that would
> let me track
> selection changes or anything that is going on while
> working with the
> grid in any way [hint! hint! hint!].

The dbgrid focus problems should be now fixed, please test. 

The problem with OnEditingDone is (or at least it was) that it was triggered even if you have not made changes to it (for example simply moving focus to another control), which is misleading because you didn't really edited anything. So Although the name On-Editing-Done is straightforward it may or not mean what you think.

It then reduces to want you want to do in OnEditingDone?

For stringgrid an event, OnValidateEntry, was introduced because of the ambiguity of OnEditingDone. But for dbgrid the underlaying dataset should have validation features (I have not really checked).

OnEditingDone is however available to be published if needed, just it needs to be defined exactly what it should do to avoid misunderstandings.

Jesus Reyes A.


      




More information about the Lazarus mailing list