• 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
Re: Can't get setDelegate to work on NSMenu attached to NSStatusItem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't get setDelegate to work on NSMenu attached to NSStatusItem


  • Subject: Re: Can't get setDelegate to work on NSMenu attached to NSStatusItem
  • From: Nick Zitzmann <email@hidden>
  • Date: Tue, 3 Mar 2009 12:47:14 -0700


On Mar 3, 2009, at 12:30 PM, Mark D. Gerl wrote:

[statusItem setMenu:theMenu];

Why are you setting the menu twice? This step might be redundant.

[statusItem setEnabled:YES];

This line is redundant and can probably be taken out.

// build NSMenu by HAND
NSMenu *menu = [[[NSMenu alloc] initWithTitle:@"abc"] autorelease];
if (menu != NULL)

You don't have to worry about this. There are a few classes that may return nil (not NULL) if initialization fails, such as NSPipe. NSMenu is not one of these classes, and most likely never will be.


[item autorelease];

Here you're autoreleasing an object you did not initialize or copy or retain, which will cause trouble if you're not using GC.


	// *** DOING this causes the menu to NOT pop down ***
	[menu setDeligate:menuController];

Is that a typo? That should be -setDelegate:. If it isn't, then that should be raising a compiler warning, in which case, do you have warnings turned off?


Nick Zitzmann
<http://www.chronosnet.com/>

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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


  • Follow-Ups:
    • Re: Can't get setDelegate to work on NSMenu attached to NSStatusItem
      • From: Quincey Morris <email@hidden>
References: 
 >Can't get setDelegate to work on NSMenu attached to NSStatusItem (From: "Mark D. Gerl" <email@hidden>)
 >Re: Can't get setDelegate to work on NSMenu attached to NSStatusItem (From: Nick Zitzmann <email@hidden>)
 >Re: Can't get setDelegate to work on NSMenu attached to NSStatusItem (From: "Mark D. Gerl" <email@hidden>)

  • Prev by Date: Re: fieldEditor not scrolling to keep insertion point / indicator visible
  • Next by Date: Re: -[UIView actionForLayer:forKey:] returns NSNull
  • Previous by thread: Re: Can't get setDelegate to work on NSMenu attached to NSStatusItem
  • Next by thread: Re: Can't get setDelegate to work on NSMenu attached to NSStatusItem
  • Index(es):
    • Date
    • Thread