• 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: NSMenu and NSMenuItem help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMenu and NSMenuItem help


  • Subject: Re: NSMenu and NSMenuItem help
  • From: Stéphane Sudre <email@hidden>
  • Date: Thu, 10 Jan 2002 18:10:02 +0100

On Thursday, January 10, 2002, at 08:53 AM, Jeff LaMarche wrote:

I'm trying to get a handle to one of the menu items in my application's menu. I'm having two problems, first of all, when I get a sub-menu using any of the itemAt... methods, it gives an uncaught exception when I then send an itemAt message to the submenu, something like this:

NSMenu *appMenu;
NSMenuItem *item;

appMenu = [[NSApp mainMenu] itemAtIndex:0];
item = (NSMenu *)([appMenu itemAtIndex:1]); <----- Exception raised: *** -[NSMenuItem itemAtIndex:]: selector not recognized

[NSMenuItem submenu]

so it should be

NSMenu *appMenu;
NSMenuItem *item;

appMenu = [[[NSApp mainMenu] itemAtIndex:0] submenu]];
[[appMenu itemAtIndex:1]submenu];


References: 
 >NSMenu and NSMenuItem help (From: Jeff LaMarche <email@hidden>)

  • Prev by Date: Re: NSMenu and NSMenuItem help
  • Next by Date: Easiest way to delete a file
  • Previous by thread: NSMenu and NSMenuItem help
  • Next by thread: Re: NSMenu and NSMenuItem help
  • Index(es):
    • Date
    • Thread