Re: Changing app menu title programmatically
Re: Changing app menu title programmatically
- Subject: Re: Changing app menu title programmatically
- From: John Stiles <email@hidden>
- Date: Thu, 14 Feb 2008 11:31:44 -0800
There is no Apple-sanctioned way to change the title of this menu, and I
haven't found a good way to do it by hook or crook either. Sorry.
Matthew Gertner wrote:
Hi,
Our application lets the user create new app bundles that have their
own name, icon, etc. but which actually spawn the original application
(with the appropriate command-line parameters) using exec. I would
like the generated app bundle to display the name of that application
as the title of the application menu. But since it's spawning the
original app, it uses its title. For example, if I use the original
app "Foo" to create a new app bundle called "Bar", I'll see "Bar" on
my desktop with the right icon, etc. But when I run it, it actually
runs Foo (since the bar executable is just a script that calls "exec
foo") and the title of the app menu is still "Foo".
I can see two possible ways to fix this. One is to change something in
Bar's app bundle so that the right name is used. I tried changing
CFBundleName in Info.plist, however, and this doesn't appear to have
any effect. Whatever I try, the name from the spawned app bundle (Foo)
is always used.
I also tried changing the menu title programmatically by registering a
notification sink for NSApplicationDidFinishLaunchingNotification. I
read somewhere that I should use:
[[NSApp mainMenu] itemAtIndex:0] submenu]
...to get the application menu. When I do so, I get a menu with the
title "Apple" (rather than "Foo" which is what I expected). When I
change the title (using setTitle), the change is not reflected in the UI.
Am I way off base in taking this approach? If so, what approach would
you recommend? If not, what do I need to do to get the menu's title to
change in the UI?
Thanks in advance,
Matt
_______________________________________________
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
_______________________________________________
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