Open OtherApp just behind MyApp
Open OtherApp just behind MyApp
- Subject: Open OtherApp just behind MyApp
- From: Yang Meyer <email@hidden>
- Date: Wed, 4 Feb 2009 15:02:20 +0100
Hi,
I want to open another application (say, Safari) in the "layer" just
behind my application.
I've researched quite a bit now, but the two "solutions" I have found
so far do not do exactly what I want.
"Solution" 1:
NSWorkspace * ws = [NSWorkspace sharedWorkspace];
[ws launchAppWithBundleIdentifier: @"com.apple.Safari"
options: NSWorkspaceLaunchWithoutActivation
additionalEventParamDescriptor: NULL
launchIdentifier: nil];
Problem with solution 1: If Safari is already active, but somewhere
behind other applications' windows (e.g. MyApp < Compose New Mail <
Mail.app < Safari, where "<" means "in front of"), then the Safari
window is not brought "up". (If Safari does NOT have open windows,
solution 1 does exactly what I want.)
"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 tried giving my app window the focus, but neither of these
work:
[[NSApp mainWindow] makeKeyAndOrderFront:NSApp]; // ?
[[NSApp keyWindow] makeKeyAndOrderFront:NSApp]; // ?
Any ideas?
Thanks a lot,
Yang
_______________________________________________
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