[Lazarus] An expression is returning false, why?
lubos.pintes at gmail.com
Sun Mar 4 21:48:45 CET 2018
Hello and thank for a reply. Do I understand correctly that a form is a
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.
Dňa 04.03.2018 o 20:44 Vojtěch Čihák via Lazarus napísal(a):
> I just tested. Active Form always returns Focused False. Use property
> Active instead.
> Result := (FControl is TCustomForm) and TCustomForm(FControl).Active;
> > Od: Lubos Pintes via Lazarus <lazarus at lists.lazarus-ide.org>
> > Komu: lazarus at lists.lazarus.freepascal.org
> > Datum: 04.03.2018 17:58
> > Předmět: [Lazarus] An expression is returning false, why?
> Sorry for possibly stupid subject and maybe off-topic question. In my
> UIA code, I am testing if a control has focus. So I have a FControl:
> TControl declared in my class.
> Now say FControl contains a TForm1 instance, simply we have very simple
> program with just an empty window. Then an expression:
> Result := FControl is TWinControl and TWinControl(FControl).Focused;
> returns false. I am sure the form has focus..., because
> ShowMessage(BoolToStr(Focused)) returns -1, which represents true...
> Lazarus mailing list
> Lazarus at lists.lazarus-ide.org
More information about the Lazarus