Re: Open OtherApp just behind MyApp
Re: Open OtherApp just behind MyApp
- Subject: Re: Open OtherApp just behind MyApp
- From: Ken Thomases <email@hidden>
- Date: Wed, 4 Feb 2009 09:21:15 -0600
On Feb 4, 2009, at 8:02 AM, Yang Meyer wrote:
I want to open another application (say, Safari) in the "layer" just
behind my application.
"Solution" 2:
[ws launchApplication:@"Safari"]; // opens Safari in front
[NSApp activateIgnoringOtherApps:YES]; // pushes my app in front,
effectively right above Safari
Problem with solution 2: I must be doing it wrong, because my own
application's window doesn't ever get its focus back and the GUI
seems to hang.
I think that -activateIgnoringOtherApps: is being done "too soon".
The NSApplicationDeactivatedEventType event is pending and hasn't had
a chance to be processed, yet. So, you need to make arrangements to
call -activateIgnoringOtherApps: after a short delay. You can use -
performSelector:withObject:afterDelay:, but you can't use -
activateIgnoringOtherApps: directly, because it doesn't have the
required signature. So, you have to implement a simple trampoline
method.
Cheers,
Ken
_______________________________________________
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