I just want a stantdard behabiour of my status item. If the button of the status item is clicked, it should be highlighted and a popup appears. As soon the popup disappears, the button is not highlighted any more. Currently the button seems to be a momentary push button, because it is only highlighted between the mouse down and mouse up event.
I tried to change the button styoe without success:
_statusItem = [statusBar statusItemWithLength:NSSquareStatusItemLength];
[_statusItem.button setButtonType:NSOnOffButton];
_statusItem.button.image = [NSImage imageNamed:@"status_item"];
_statusItem.button.image.size = NSMakeSize(22.0, 22.0);
_statusItem.button.image.template = YES;
_statusItem.button.action = @selector(statusItemClicked:);
_statusItem.button.target = self;
Then I tried to highlight the button programmatically:
-(IBAction)statusItemClicked:(id)sender {
if (!_statusItemWindowController) {
_statusItemWindowController = [[IQSRStatusItemWindowController alloc] initWithWindowNibName:@"StatusItemPanel"];
}
if (_statusItemWindowController.window.isVisible) {
[_statusItemWindowController hideStatusItemWindow];
[_statusItem.button setState:NSOffState];
[_statusItem.button highlight:NO];
} else {
[_statusItemWindowController showStatusItemWindow];
[_statusItem.button setState:NSOnState];
[_statusItem.button highlight:YES];
}
}
This is not working either. Has someone an idea? I could exchange the image, but this is more a workaround and not a solution.