[Lazarus] intercepting keyboard events

Ondrej Pokorny lazarus at kluug.net
Mon May 8 18:22:30 CEST 2017


On 08.05.2017 17:42, Michael Van Canneyt via Lazarus wrote:
> Is there something that must be called/set when creating the control 
> to make
> it receive focus ?

If you mean receiving focus by clicking on it then yes, you need to call 
SetFocus in MouseDown. It's also a good idea to check the csNoFocus flag 
(from ControlStyle property).

For an example look how it is done in TCustomDBGrid.MouseDown.

+ The control can always get focused by the Tab key, if TabStop=True.

Ondrej




More information about the Lazarus mailing list