NSStatusItem not highlighted when using NSWindow instead of NSMenu

  • Hi all,

    I have set up a NSStatusItem in the following way:

    NSStatusBar *bar = [NSStatusBar systemStatusBar];
    theItem = [bar statusItemWithLength:NSVariableStatusItemLength];
    [theItem retain];
    [theItem setTitle:NSLocalizedString(@"Menu Title", @"")];
    [theItem setHighlightMode:YES];
    [theItem setToolTip:@"Menu ToolTip"];
    [theItem setEnabled:YES];
    [theItem sendActionOn:NSLeftMouseDownMask];
    [theItem setTarget:self];
    [theItem setAction:@selector(showInterface:)];
    [theItem setMenu:nil];

    It is set to send an action on a left mouse click.  This then runs
    the method showInterface: which activates an NSWindow:

    - (void)showInterface:(id)sender
    {
    [theWindow makeKeyAndOrderFront:(id)sender];
    // when interface is shown, make application active
    [theApp activateIgnoringOtherApps:YES];
    }

    Also note that I have set the NSStatusItem to have no menu
    (setMenu:nil) .

    My issue is that when the user clicks on the status item in the
    status bar, the text "Menu Title" is highlighted only for as long as
    the mouse remains left-clicked on it.  In other words, it acts like a
    push button.  The method showInterface: is launched and the NSWindow
    is displayed just fine however the status item is not highlighted to
    reflect that it is active.

    Does anyone know how to keep the status item highlighted while the
    NSWindow is displayed on screen?  I have looked at all possible
    documentation and experimented with notifications and delegate
    methods for NSWindow and NSApplication but have come across nothing
    so far.

    Any help is greatly appreciated!

    Thanks!

    Regards,
    Basil.
previous month january 2007 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