NSStatusItem: Can't set custom NSView and still have menu?
NSStatusItem: Can't set custom NSView and still have menu?
- Subject: NSStatusItem: Can't set custom NSView and still have menu?
- From: Greg Hurrell <email@hidden>
- Date: Sat, 26 Apr 2003 01:11:40 +0930
I have an NSStatusItem in my menu bar which contains a custom NSView.
I am now trying to set a menu that will drop down when the view is
clicked.
[MYStatusItem setView:MYView];
NSLog(@"Menu (before setting) is: %@", [MYStatusItem menu]);
[MYStatusItem setMenu:MYGlobalMenu];
NSLog(@"Menu (after setting) is: %@", [MYStatusItem menu]);
The trouble is, even after setting the menu, both NSLog statements
return "NULL" and there's no menu set. In other words, Cocoa refuses to
attach the menu to the NSStatusItem.
If I get rid of the custom view, then it works. eg:
//[MYStatusItem setView:MYView];
NSLog(@"Menu (before setting) is: %@", [MYStatusItem menu]);
[MYStatusItem setMenu:MYGlobalMenu];
NSLog(@"Menu (after setting) is: %@", [MYStatusItem menu]);
All I've done above is comment out the line assigning the custom view.
This time Cocoa accepts the menu, it gets attached and displays no
problems. The second NSLog statement correctly prints out the expected
menu description (not NULL).
So what's up? Is this a Cocoa bug? (puts on flame-retardant suit) Is
there something else I need to do?
Playing with other NSStatusItem settings has no impact on the
phenomenon as described above.
Thanks for the constructive input.
Cheers
Greg
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.