[Lazarus] An expression is returning false, why?

Lubos Pintes lubos.pintes at gmail.com
Mon Mar 5 09:41:41 CET 2018


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? 
Only if it makes sense of course. So probably something like I tried 
before, that is the control is a TWinControl instance and the Focused 
property is true?
I know it doesn't work for a form itself. Maybe this is a bug?
Dňa 05.03.2018 o 8:53 zeljko via Lazarus napísal(a):
> On 03/04/2018 09:48 PM, Lubos Pintes via Lazarus wrote:
>> Hello and thank for a reply. Do I understand correctly that a form is 
>> a special case?
>> What about TEdit or TButton for example? I am encapsulating a TControl 
>> instance and am asking for properties needed for UI Automation, 
>> occasionally asking if the encapsulated control is a TWinControl 
>> instance.
>> I tested the simplest LCL program, just an empty form, and it really 
>> caused me headache. I just forcefully set the HasKeyboardFocus 
>> property to true for testing and the form was reported correctly.
> 
> Use MyForm.ActiveControl to get focused control on active form.
> 
> zeljko




More information about the Lazarus mailing list