• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Programatically Change NSMenu Title
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Programatically Change NSMenu Title


  • Subject: Programatically Change NSMenu Title
  • From: "Chunk 1978" <email@hidden>
  • Date: Tue, 4 Nov 2008 15:02:37 -0500

for localization purposes, i'd like to programatically change all of
my app's menu item titles.

#import <Cocoa/Cocoa.h>

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

@interface AppController : NSObject
       {
       //Main Menu Outlets
       IBOutlet id MenuItem1;
       IBOutlet id MenuItem2;
       }

@end

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

#import "AppController.h"

static NSString * CONSTMenuItem1;
static NSString * CONSTMenuItem2;

@implementation AppController

- (void)awakeFromNib
       {
       CONSTMenuItem1 = NSLocalizedString (@"ENGLISH MENU", nil);
       [MenuItem1 setTitle:CONSTMenuItem1];

       CONSTMenuItem2 = NSLocalizedString (@"English Item...", nil);
       [MenuItem2 setTitle:CONSTMenuItem2];
       }

@end

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

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.

thoughts?
_______________________________________________

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

  • Follow-Ups:
    • Re: Programatically Change NSMenu Title
      • From: Peter Ammon <email@hidden>
    • Re: Programatically Change NSMenu Title
      • From: Christopher Hickman <email@hidden>
  • Prev by Date: Re: Get MD5 without crashing (Mr. Gecko)
  • Next by Date: Re: Underlining text in Interface Builder
  • Previous by thread: Re: Get MD5 without crashing (Mr. Gecko)
  • Next by thread: Re: Programatically Change NSMenu Title
  • Index(es):
    • Date
    • Thread