Help with running in background

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

  1. geoldr macrumors newbie

    Apr 1, 2011
    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. kainjow Moderator emeritus


    Jun 15, 2000
    You probably need to make your app the frontmost:

    [NSApp activateIgnoringOtherApps:YES];
  3. geoldr thread starter macrumors newbie

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

Share This Page