Re: app with quick-entry dialog
Re: app with quick-entry dialog
- Subject: Re: app with quick-entry dialog
- From: Michael Ash <email@hidden>
- Date: Sat, 21 Aug 2010 17:53:00 -0400
On Sat, Aug 21, 2010 at 12:16 PM, Martin Hewitson
<email@hidden> wrote:
> Dear list,
>
> I'm building an app which supports a quick-entry dialog triggered by a global hot-key so that the user can make entries while working in another app. I have this all working fine except for one thing. When the quick-entry dialog is dismissed, the main app window is made active, and even the Spaces space is switched. What I'd like is to return focus to the app that was running before the user pressed the global hot-key. The quick-entry window is shown as modal from the app delegate class.
>
> Has anyone got any hints how I might achieve the desired effect?
Before you activate your own application, find out which application
is currently active using e.g. GetFrontProcess(). Stash the result in
a variable somewhere. When finished, reactivate the previous
application by calling e.g. SetFrontProcessWithOptions(). Be sure to
gracefully handle the case where that application is no longer
running, although that should be rare enough to not need to be *too*
graceful.
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden