Search code examples
cocoansapplicationnspanel

about panel in menubar application is not frontmost when activated


I have an application that lives in the menubar, without a main menu or dock icon. I have a button that triggers [NSApp orderFrontStandardAboutPanel:sender];. When that button is clicked, sometimes, the About panel becomes frontmost. Other times, however, the About panel opens, but behind other running application windows (to be clear, behind windows of OTHER applications, not behind my popover from the menubar). I'm not even sure where to start with debugging this - any suggestions?

Thanks.


Solution

  • NSApplication *app = [NSApplication sharedApplication];
    [app activateIgnoringOtherApps:YES];
    [NSApp orderFrontStandardAboutPanel:sender];
    

    Please try the code above.