• 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
Re: Forcing an application into the foreground
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Forcing an application into the foreground


  • Subject: Re: Forcing an application into the foreground
  • From: John Stiles <email@hidden>
  • Date: Wed, 2 Mar 2005 14:08:58 -0800

It is illegal to launch a Cocoa/Carbon app via a BSD call like fork/exec. You will get goofy unspecified behavior, and the fact that it's not coming to the foreground is in fact one of those symptoms. (Another symptom I've seen is that the menubar sometimes fails to draw.)

You need to use NSWorkspace or Launch Services to launch your app.

Another poster suggested using "open /whatever/YourApp.app", and this will probably work too because open calls Launch Services internally. However, using NSWorkspace is only one or two lines of code, and probably has fewer goofy side effects. (i.e. someone could construct an app name that will generate problems for your synthesized command line.)


On Mar 2, 2005, at 12:53 PM, Sarah Dumoulin wrote:

Hello,

I have a coca application that I am calling through an execlp call in a
c program. The application launches properly, however it is always in the
background (no windows are visible). I had thought that calling
makeKeyAndOrderFront on the window that I wanted visible would fix this
problem, but doing so made no difference. Does makeKeyAndOrderFront only
order windows within an application? If so, is there some way of forcing
the application itself into the foreground? I didn't see a method that
seemed appropriate under NSApplication, but I am far from a cocoa expert :)


I don't want to run a modal window (although perhaps forcing the app
briefly into modal mode would work as a kluge?). I would just like the user
to be able to see the running application without having to command-tab or
choose it off the finder bar. Any suggestions or pointers would be greatly
appreciated.


Thanks,

Sarah

--
Sarah Dumoulin email@hidden
Communications Research Centre www.crc.ca
Ottawa, ON
Phone: 613-990-5242
Fax: 613-998-9648


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Forcing an application into the foreground
      • From: Douglas Davidson <email@hidden>
    • Re: Forcing an application into the foreground
      • From: Finlay Dobbie <email@hidden>
References: 
 >Forcing an application into the foreground (From: Sarah Dumoulin <email@hidden>)

  • Prev by Date: Re: Forcing an application into the foreground
  • Next by Date: keyDown:not receiving Command + key events, space bar, left/right arrows
  • Previous by thread: Re: Forcing an application into the foreground
  • Next by thread: Re: Forcing an application into the foreground
  • Index(es):
    • Date
    • Thread