1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Help with running in background

Discussion in 'Mac Programming' started by geoldr, Apr 2, 2011.

  1. macrumors newbie

    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?
  2. Moderator emeritus


    You probably need to make your app the frontmost:

    [NSApp activateIgnoringOtherApps:YES];
  3. macrumors newbie

    Ok cool thank you, you pointed me in the right direction. I used this code
    [NSApp activateIgnoringOtherApps: YES];
    [window makeKeyAndOrderFront: self];

Share This Page