[Lazarus] An expression is returning false, why?

Vojtěch Čihák vojtech.cihak at atlas.cz
Sun Mar 4 20:44:59 CET 2018


Hi,
I just tested. Active Form always returns Focused False. Use property Active instead.
 
Result := (FControl is TCustomForm) and TCustomForm(FControl).Active;
 
V.
______________________________________________________________
> 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?
>
Hello,
 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
 https://lists.lazarus-ide.org/listinfo/lazarus <https://lists.lazarus-ide.org/listinfo/lazarus>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180304/64b06d47/attachment-0001.html>


More information about the Lazarus mailing list