• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSStatusItem: Can't set custom NSView and still have menu?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: NSStatusItem: Can't set custom NSView and still have menu?
      • From: Tom Sutcliffe <email@hidden>
  • Prev by Date: Embedded framework prevents app from debugging
  • Next by Date: Re: Putting a single " into an NSString or adding it to an NSMutableString?
  • Previous by thread: Re: Embedded framework prevents app from debugging
  • Next by thread: Re: NSStatusItem: Can't set custom NSView and still have menu?
  • Index(es):
    • Date
    • Thread