FROM : Stéphane Sudre
DATE : Thu Jan 10 18:10:02 2002
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];
DATE : Thu Jan 10 18:10:02 2002
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];
| Related mails | Author | Date |
|---|---|---|
| Jeff LaMarche | Jan 10, 08:53 | |
| Thomas Lachand-Rob… | Jan 10, 09:43 | |
| Jeff LaMarche | Jan 10, 17:41 | |
| Jeff LaMarche | Jan 10, 17:45 | |
| Stéphane Sudre | Jan 10, 18:10 | |
| Thomas Lachand-Rob… | Jan 10, 19:21 |






Cocoa mail archive

