On Sat, Aug 21, 2010 at 12:16 PM, Martin Hewitson <martin.hewit...@aei.mpg.de> 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 (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com