Getting the last active form on Alt+Tab away from the app.
3 posts
• Page 1 of 1
Getting the last active form on Alt+Tab away from the app.
Has anyone figured out how to get the form/sub-form that is active and has focus when a user hits Alt+Tab to switch away form the interpreter. Windows will always set focus to the main application form when the user again switches back with Alt+Tab. It's an issue for keyboard heavy users that quickly alternate between applications. They hate having to click on a sub-form to continue working as they were.
I tried the ActivateApp event with WinAPI calls to get the active/focused form but either I'm doing something wrong or the interpreter has already lost form focus when Event callback is executed.
I tried the ActivateApp event with WinAPI calls to get the active/focused form but either I'm doing something wrong or the interpreter has already lost form focus when Event callback is executed.
(It's the little things that make the difference :-)
-
norbertjurkiewicz84 - Posts: 62
- Joined: Mon Nov 01, 2010 7:26 pm
Re: Getting the last active form on Alt+Tab away from the ap
What about catching the LostFocus event? You can figure out whether it's about to go to another application. If that's the case you can use GetFocus to save a ref pointing to the control that has the focus at that very moment
Later, when you come back from elsewhere you can use this to re-establish the focus.
Later, when you come back from elsewhere you can use this to re-establish the focus.
-
kai - Posts: 137
- Joined: Thu Jun 18, 2009 5:10 pm
- Location: Hillesheim / Germany
Re: Getting the last active form on Alt+Tab away from the ap
I thought about tracking each LostFocus event but CAS already uses many special instances of it to handle cleanup and auto-complete tasks. These tend to be specialized to what is happening. Rewriting those functions along with assigning a generic callback to all forms, without a LostFoucus event, will likely create a large number of GUI bugs.
I thought about having something intercepting the related Focus and Activate Windows Messages but I'd really like that to be a last resort. I hope to just be missing the obvious solution.
I thought about having something intercepting the related Focus and Activate Windows Messages but I'd really like that to be a last resort. I hope to just be missing the obvious solution.
-
norbertjurkiewicz84 - Posts: 62
- Joined: Mon Nov 01, 2010 7:26 pm
3 posts
• Page 1 of 1
Return to Windows: GUI, COM/OLE/ActiveX
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group