Re: How to track global focus?
Re: How to track global focus?
- Subject: Re: How to track global focus?
- From: Bill Cheeseman <email@hidden>
- Date: Mon, 29 May 2006 12:41:14 -0400
- Thread-topic: How to track global focus?
on 2006-05-29 9:35 AM, David Niemeijer at email@hidden wrote:
> I need to track the focused UIElement. Within an application I can
> get notifications of when the focused UIElement changes, but there
> seems to be no way to get a notification system wide, thus when the
> focused UIElement changes either within the front app or from app A
> to app B or to the Dock, etc.
Here's a thought in case your application is a Cocoa application: Use your
app's Cocoa notification center to register to observe the NSWorkspace
NSWorkspaceDidLaunchApplicationNotification. Every time it detects that a
new application is launched, register an accessibility notification on the
new application to observe the AXApplicationActivated notification. At any
point in time, for example when your application is launched, you can use
NSWorkspace to get a list of all running applications and register to
observe AXApplicationActivated on all of them.
I believe NSWorkspace does not detect launches of faceless background
applications, which would include the Dock and the SystemUIServer, and I
know it does not include them in its list of running applications. Perhaps
Carbon has better capabilities to notice when faceless background
applications are launched. I know it can give you a list of running
applications that includes faceless background applications.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
PreFab Software - http://www.prefab.com/scripting.html
The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden