tags:

views:

83

answers:

1

If you call

NSRunAlertPanel()

from a background process in Cocoa, the dialogue does not come to the front and instead stays behind other windows. This post shows that you can bring the dialogue to the front if you convert the process to a foreground process. If you keep the process a background process, however, is there any way to achieve this behavior?

+1  A: 

What are you trying to do? Background processes can still display UI and bring themselves to the front without using TransformProcessType; just make sure you are a LSUIElement, not LSBackgroundOnly (or the deprecated NS* equivalents). The only reason you typically need to use TransformProcessType is if you want a Dock icon or menu bar.

Nicholas Riley
I have a program running that has a presence in the menu bar. When the program starts running, I want it to throw up a dialogue that asks the user whether or not they want to set the program to run at startup. Right now calling `NSRunAlertPanel()` the dialogue comes up but is often hidden behind other windows. How would I keep my program running with only a menu bar presence but make the dialogue come to the front of all the windows?
mon4goos
You need to bring your app to the front then: [NSApp activateIgnoringOtherApps: YES];
Nicholas Riley