[Lazarus] An expression is returning false, why?

Giuliano Colla giuliano.colla at fastwebnet.it
Mon Mar 5 11:08:49 CET 2018

Il 05/03/2018 09:41, Lubos Pintes via Lazarus ha scritto:

> Hello and thank. And in general, if I have a TControl instance, can 
> you tell me a reliable algorithm that tells me if the control has a 
> focus? 

By definition, the focused control is the control which receives 
keyboard input.
That's why the form in itself is never focused because a form doesn't 
handle keyboard input.
With just a form you may strike any key, and nothing will happen: the 
keyboard input is simply ignored.

The Form's ActiveControl property tells you which control has focus and 
will receive the keyboard input.

The control's Focused property tells you if the control has focus.

The focused control may be a button a TEdit, or whatever control which 
may perform an action upon striking a key.
You may push a focused button by striking the enter key or the space 
bar, you may enter text on a Tedit, etc.


More information about the Lazarus mailing list