[Lazarus] Grids and DBgrids

Alexander Klenin klenin at gmail.com
Sun Mar 7 04:12:59 CET 2010


On Sun, Mar 7, 2010 at 09:23, JoshyFun <joshyfun at gmail.com> wrote:
> Hello Lazarus-List,
>
> Maybe somebody had noted that all keys that perform some action in a
> DBGrid by default are never passed to the KeyPress event, like return,
> delete, keyup, keydown,... The reason is that this actions are handled
> in the keydown event and to note that they are handled by the DBGrid
> the "Key" variable is set to zero which finally prevent the right key
> value to be handled by "KeyPress" as zero is "invalid".
>
> I had fixed it in my local copy using the "CanGridHandleKey" but also
> in "Grids" (TCustomGrid) some keys are handled to perform default
> operations and when performed the "Key" is set to zero also. I think
> they can be safelly removed, the zero setting, but I wish to know if
> somebody is aware of the reason to set them to zero.

Although I have no particular need for this change, I support it
on the general principle. I would go even further and call KeyPress
_before_ built-in handler, so that user code could turn off
default handling by setting the key code to zero.

-- 
Alexander S. Klenin




More information about the Lazarus mailing list