setting application and window focus
setting application and window focus
- Subject: setting application and window focus
- From: Keith Alperin <email@hidden>
- Date: Wed, 29 Mar 2006 10:41:16 -0600
Greetings Accessibility-devs!
I have a cocoa agent application (one that does not show up in the
dock, though it can come forward and present a UI). I use a hot key
to bring up a window from my agent app and then do something. When
it is done, i hide the window and want to return focus the previously
focused window. I keep AXUIElementRefs of the focused Application,
window and even kAXFocusedUIElementAttribute from before i change
focus to my agent app. I've tried a number of ways to return focus
to the original window, but none of them seem to work:
theErr = AXUIElementSetAttributeValue(previouslyFocusedApplication,
kAXMainAttribute, kCFBooleanTrue);
theErr = AXUIElementSetAttributeValue(previouslyFocusedApplication,
kAXFocusedApplicationAttribute, kCFBooleanTrue);
theErr = AXUIElementSetAttributeValue(previouslyFocusedWindow,
kAXFocusedWindowAttribute, kCFBooleanTrue);
theErr = AXUIElementSetAttributeValue(previouslyFocusedWindow,
kAXMainAttribute, kCFBooleanTrue);
theErr = AXUIElementSetAttributeValue(previouslyFocusedWindow,
kAXFocusedAttribute, kCFBooleanTrue);
theErr = AXUIElementSetAttributeValue(previouslyFocusedApplication,
kAXFocusedUIElementAttribute, previouslyFocusedElement);
after each of these, i check what the kAXFocusedApplicationAttribute
of the system wide element is and it's always my agent application.
I'm not that experienced with the Accessibility API, is there a
simple way to set the focus of a specific application and window?
Many thanks,
Keith R. Alperin
_______________________________________________
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