• 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
Built Menu not firing the action
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Built Menu not firing the action


  • Subject: Built Menu not firing the action
  • From: Steve Cronin <email@hidden>
  • Date: Mon, 25 Aug 2008 02:53:23 -0500

Folks;

I'm building a data driven submenu programmatically.
The submenu appears correctly in the UI with the correct titles but nothing happens when these items are selected.


submenu build code:

menu1 = [[[NSMenu alloc] initWithTitle:@"__"] retain];
[menu1 setAutoenablesItems:NO];
NSEnumerator *titleEnum = [someArray objectEnumerator];
while ((nextTitle = [titleEnum nextObject])!=nil) {
[menu1 addItemWithTitle:nextTitle action:@selector(customAction:) keyEquivalent:@""];
}
...
[[[[[[mainMenu itemAtIndex:3] submenu] itemWithTag:1000] submenu] itemWithTag:1003] setSubmenu: menu1];



I spit menu1 out to NSLog and it looks fine. I set a breakpoint at customAction: it NEVER gets called. (Yes I have spelled it correctly [- (void) customAction:(id)sender;]

This is on the mainMenu in the main XIB file. There is an outlet from appDelegate for mainMenu, this is set.
The menu itself has the appDelegate set as its' delegate.
The selector method is o method in the appDelegate object.
There are no selector bindings set.
(Note: there are enabled bindings set which are working correctly)


I'm just stumped! I probably could use some sleep...
Also how do you show some useful data from a SEL value in NSLog? ie print [NSMenuItem action]?


Since nothing happens how do I debug this?
Thank-you for any insights!
Steve
_______________________________________________

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: Built Menu not firing the action
      • From: Peter Ammon <email@hidden>
  • Prev by Date: [moderator] Re: How to control the order of enumerating on a NSDictionary
  • Next by Date: Re: *** -[NSSavePanel _blocksActionWhenModal:]: message sent to deallocated instance 0x15a05e50
  • Previous by thread: Re: Problems running bannersample example project.
  • Next by thread: Re: Built Menu not firing the action
  • Index(es):
    • Date
    • Thread