Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Window Focus

183 views
Skip to first unread message

James Martin

unread,
Aug 6, 2022, 7:15:09 PM8/6/22
to
Is there a way I can check whether a window is in focus?

I have a window that is sometimes in the background and has a timer
running every second. Sometimes when a certain condition exists it gives
focus to a single line edit. This is perfect when the window is in
focus, but annoying when you are in another window, since it robs the
cursor from the window you are working in.

Can I check whether the window has focus before I set the focus to the SLE?

Thanks for all the help I get here. VO still works very well!

James

Jamal

unread,
Aug 7, 2022, 2:12:57 AM8/7/22
to
You can use the FocusChange() and Activate() callback events of the
Window class.

The docs has an explanation and sample code for those events.

Jamal

James Martin

unread,
Aug 20, 2022, 1:35:09 PM8/20/22
to
Thanks. I saw them this morning but wasn't sure what they were for. Do
you know whether switching between tabs also works the same way? When
you switch between tabs you change window focus on one hand, however in
another sense you are still in the same master window.

James

Jamal

unread,
Aug 22, 2022, 10:33:27 AM8/22/22
to
For the tab selection changing, in the parent window (the one has the
tabcontrol), look at the Properties, CommonControl Events, then select
TabSelChanging.

Jamal

James Martin

unread,
Sep 26, 2022, 8:51:49 PM9/26/22
to
>Thanks. You got me on the right track. Can tab have their colour
changed in VO?

James

Phil McGuinness

unread,
Sep 30, 2022, 10:14:28 PM9/30/22
to
snip[ Can I check whether the window has focus before I set the focus to the SLE? ]

oControl := GetFocusedObject() // Make sure we put focus back on original control.
IF oControl != NULL_OBJECT

You can check the Class of the object

jmm...@gmail.com

unread,
Mar 10, 2023, 11:17:17 AM3/10/23
to
The method TabSelChanging() gives the tab changed from. I needed the one that I changed to. I used "TabSelected" which did what I wanted.

James
0 new messages