Re: Can't get setDelegate to work on NSMenu attached to NSStatusItem
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