• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Open OtherApp just behind MyApp
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Open OtherApp just behind MyApp
      • From: "Sean McBride" <email@hidden>
    • Re: Open OtherApp just behind MyApp
      • From: Ken Thomases <email@hidden>
  • Prev by Date: Re: NSTask in separate thread is leaking memory
  • Next by Date: Re: AquaticPrime Config.php + PayPal Advanced Variables Not Working
  • Previous by thread: Re: Core animation - Safari Find effect
  • Next by thread: Re: Open OtherApp just behind MyApp
  • Index(es):
    • Date
    • Thread