Re: Reliable way to get application (Apple) menu?
Re: Reliable way to get application (Apple) menu?
- Subject: Re: Reliable way to get application (Apple) menu?
- From: Justin Spahr-Summers <email@hidden>
- Date: Sat, 12 Mar 2005 14:39:16 -0600
Well, first of all, the Apple menu and the Application menu are NOT
the same thing. The Apple menu is the blue apple which contains
system-wide stuff, the Application menu is specific to your program.
And secondly, wouldn't
[[NSApp mainMenu] itemAtIndex:0]
work, seeing as it's going to be the first menu all the time?
On Sat, 12 Mar 2005 13:58:51 +0000, Jeremy Dronfield
<email@hidden> wrote:
> Here's a strange omission I stumbled over when trying to remove some
> items from my app's application (or, confusingly, "Apple") menu at
> launch. First, I tried the obvious ploy of accessing it with:
>
> NSMenu *appMenu = [[[NSApp mainMenu] itemWithTitle:myAppName] submenu];
>
> but that doesn't work, so I tried outputting a description of [NSApp
> mainMenu], and found that the item actually has no title:
>
> <MenuItem: 0x34d470 , submenu: 0x342b30 (Apple)>, <<< No title!
> <MenuItem: 0x343490 File, submenu: 0x341bf0 (File)>,
> <MenuItem: 0x342850 Edit, submenu: 0x343840 (Edit)>,
> <MenuItem: 0x3434d0 View, submenu: 0x34c710 (View)>,
>
> So instead I've done:
>
> NSMenu *appMenu = [[[NSApp mainMenu] itemWithTitle:@""] submenu];
>
> which works. But I'll be stuffed if Apple changes this untitled state
> in the future. NSApplication has convenience methods for returning
> -windowsMenu and -servicesMenu. It also has a -setAppleMenu: method for
> changing the application menu, but nothing for accessing it. Why isn't
> there an -appleMenu method? Is there a reliable way of accessing this
> menu which I've overlooked?
>
> Regards,
>
> -Jeremy
>
> ===================================
> SkoobySoft, home of viJournal and Skooby Renamer
> email: email@hidden or visit:
> http://freespace.virgin.net/jeremy.dronfield/skoobysoft.html
> ===================================
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden