View Full Version : Help with running in background

Apr 2, 2011, 03:12 AM
Hello, so I have created an application that uses the
"Application is background only" plist variable to run my program without a menu bar or dock icon. I have created an NSStatusMenu, and when i click that my main window opens. I am having a problem, however, with the program displaying behind other windows. So if I run my program from xcode, and open the window by clicking the icon in the menu, it will pop up behind xcode, and I have to move xcode to see it. I am sure there has to be a way to make it show it show up on top. Does anybody have a way to do this?

Apr 2, 2011, 11:28 AM
You probably need to make your app the frontmost:

[NSApp activateIgnoringOtherApps:YES];

Apr 2, 2011, 06:24 PM
Ok cool thank you, you pointed me in the right direction. I used this code

[NSApp activateIgnoringOtherApps: YES];
[window makeKeyAndOrderFront: self];