Re: Altering an existing menu item
Re: Altering an existing menu item
- Subject: Re: Altering an existing menu item
- From: Neil Earnshaw <email@hidden>
- Date: Wed, 20 Aug 2003 14:42:25 +0100
It seems to work fine. I created a new Cocoa Document-based App and
modified the document's windowControllerDidLoadNib: method like so:
- (void)windowControllerDidLoadNib:(NSWindowController *) aController
{
[super windowControllerDidLoadNib:aController];
// Add any code here that need to be executed once the
windowController has loaded the document's window.
NSMenuItem* item = [[NSApp mainMenu] itemWithTitle:@"Edit"];
[item setTitle:@"Hack"];
}
Run the app and the edit menu's title is now 'Hack'.
Where are you trying to do it? Does some responder have a
validateMenuItem: method that's undoing your change?
-Neil
On Monday, August 18, 2003, at 10:55 AM, John Lombardo wrote:
Is there some magic trick I need to do to make changes to a menu item
take
effect? I can reference a particular menu item using:
[[[[NSApp mainMenu] itemWithTitle:@"Modules"] submenu]
itemWithTitle:@"Administration"]
And I know this works because I can print it's title using NSLog().
However,
when I use setImage or setTitle, nothing happens. I thought maybe
there was
some sort of refresh, reload, or justBloodyDoIt method for NSMenuItem,
but I
couldn't find anything.
This isn't a critical issue, but it would be nice to know what is
going on.
Cheers,
john
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
Neil Earnshaw
Consultant Software Engineer
Object Software Engineers Ltd
email@hidden
Tel : 01747 854 852
Mbl : 07870 209 102
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.