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

    #1
    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

    kainjow

    #2
    You probably need to make your app the frontmost:

    Code:
    [NSApp activateIgnoringOtherApps:YES];
     
  3. macrumors newbie

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

Share This Page