App menubar dead

  • I hide my app programmatically. But when it unhides, its menubar is
    unresponsive. Any ideas on how to avoid this problem?

    Specifically, my app can open a utility window that floats above all other
    apps. When the utility window loads, I call NSWindow's setCanHide:No on it
    so that it can't be hidden, then I call [NSApp hide:] to hide all my app's
    other windows. Then, when I click on the utility window, all my app's other
    windows become unhidden (the system does this, not my code). However,
    although my app's menu bar appears at the same time, it is unresponsive.

    If I activate another app -- for example, the Finder by clicking on the
    desktop -- then reactivate my app, my app's menubar comes back to life.

    I would be happy with either of these solutions: (1) prevent the application
    from unhiding when I click in the utility window, or (2) make the menubar
    responsive as soon as it does unhide. I can't find a way to implement either
    solution.

    Any ideas?

    --

    Bill Cheeseman - <wjcheeseman...>
    Quechee Software, Quechee, Vermont, USA
    http://www.quecheesoftware.com

    PreFab Software - http://www.prefab.com/scripting.html
    The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
    Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
  • On 25-Oct-06, at 6:15 PM, Bill Cheeseman wrote:

    > Specifically, my app can open a utility window that floats above
    > all other
    > apps.

    It sounds to me like you would be better off implementing this
    "utility window" as a separate app and applying appropriate
    LSUIElement values. Then your main app could just launch this utility-
    window-app and the two apps would be separate from the windowserver's
    point of view

    --
    Cameron Hayne
    <hayne...>
  • on 2006-10-25 6:15 PM, Bill Cheeseman at <wjcheeseman...> wrote:

    > I hide my app programmatically. But when it unhides, its menubar is
    > unresponsive. Any ideas on how to avoid this problem?

    For the archives:

    This appears to be a longtime bug in Cocoa. The issue was raised, confirmed
    by another developer, but not solved back in 2002,
    here:<http://www.cocoabuilder.com/archive/message/cocoa/2002/8/16/60669>

    I have found a workaround. I set my utility window's controller to be my app
    delegate temporarily, and implement the -[NSApplication
    applicationWillUnhide:] delegate method like this:

    - (void)applicationWillUnhide:(NSNotification *)notification {
        // Delegate method per NSApplication. Needed here to work around Mac OS
    X bug where clicking in unhidable app window while app is hidden fails to
    show app menu bar unless another app is activated first.
            [[NSWorkspace sharedWorkspace] launchApplication:[[[[NSWorkspace
    sharedWorkspace] launchedApplications] objectAtIndex:0]
    objectForKey:@"NSApplicationPath"]]; // oldest running app
            [NSApp activateIgnoringOtherApps:YES];
            [[[self browserController] window] makeKeyAndOrderFront:nil];
    }

    --

    Bill Cheeseman - <wjcheeseman...>
    Quechee Software, Quechee, Vermont, USA
    http://www.quecheesoftware.com

    PreFab Software - http://www.prefab.com/scripting.html
    The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
    Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
  • on 2006-10-26 4:38 AM, Cameron Hayne at <hayne...> wrote:

    > It sounds to me like you would be better off implementing this
    > "utility window" as a separate app and applying appropriate
    > LSUIElement values. Then your main app could just launch this utility-
    > window-app and the two apps would be separate from the windowserver's
    > point of view

    Yes, I thought of doing that, but it's a lot of work. See my message a
    moment ago with an easier solution.

    --

    Bill Cheeseman - <wjcheeseman...>
    Quechee Software, Quechee, Vermont, USA
    http://www.quecheesoftware.com

    PreFab Software - http://www.prefab.com/scripting.html
    The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
    Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
  • Am 26.10.2006 um 00:15 schrieb Bill Cheeseman:
    > I would be happy with either of these solutions: (1) prevent the
    > application
    > from unhiding when I click in the utility window, or (2) make the
    > menubar
    > responsive as soon as it does unhide. I can't find a way to
    > implement either
    > solution.

      I think in the Moose I did the former by making my floating window
    a non-activating panel.

    Cheers,
    -- M. Uli Kusterer
    http://www.zathras.de
  • on 2006-10-29 7:42 AM, Uli Kusterer at <witness.of.teachtext...> wrote:

    > Am 26.10.2006 um 00:15 schrieb Bill Cheeseman:
    >> I would be happy with either of these solutions: (1) prevent the
    >> application
    >> from unhiding when I click in the utility window, or (2) make the
    >> menubar
    >> responsive as soon as it does unhide. I can't find a way to
    >> implement either
    >> solution.
    >
    > I think in the Moose I did the former by making my floating window
    > a non-activating panel.

    That works. Long live the Moose!

    --

    Bill Cheeseman - <wjcheeseman...>
    Quechee Software, Quechee, Vermont, USA
    http://www.quecheesoftware.com

    PreFab Software - http://www.prefab.com/scripting.html
    The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
    Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today