NSStatusItem not highlighted when using NSWindow instead of NSMenu
NSStatusItem not highlighted when using NSWindow instead of NSMenu
- Subject: NSStatusItem not highlighted when using NSWindow instead of NSMenu
- From: Basil Shkara <email@hidden>
- Date: Wed, 10 Jan 2007 12:05:48 +1100
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.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden