Re: Programatically Change NSMenu Title
Re: Programatically Change NSMenu Title
- Subject: Re: Programatically Change NSMenu Title
- From: Peter Ammon <email@hidden>
- Date: Tue, 4 Nov 2008 13:55:04 -0800
On Nov 4, 2008, at 12:02 PM, Chunk 1978 wrote:
for localization purposes, i'd like to programatically change all of
my app's menu item titles.
....
the above code works fine for everything except the menu bar titles
(like "File", "Edit", "Window", etc.)... when i click on these objects
in IB i've noticed it's displaying
the title of the "NSMenu" instead of the title for "NSMenuItem" in IB,
but i can't seem to hook it up to NSMenu, so i'm not sure if this is
possible.
The text that appears in the menu bar is taken from the title of the
NSMenu, and not the NSMenuItem. To change the title of the "Edit"
menu, you would write [[[[NSApp mainMenu] itemAtIndex:2] submenu]
setTitle:@"New Title"] .
Before Leopard, there was a bug where the initial title was taken from
the NSMenu, but changes to the NSMenuItem title affected the menu bar
text. This got fixed in Leopard, and the NSMenu's title is always
used now. For maximum compatibility with pre-Leopard OSes, set both
to be the same.
-Peter
_______________________________________________
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