• 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
Re: NSUndoManager returns menu item titles with unwanted ampersand ("&Undo Typing")
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSUndoManager returns menu item titles with unwanted ampersand ("&Undo Typing")


  • Subject: Re: NSUndoManager returns menu item titles with unwanted ampersand ("&Undo Typing")
  • From: Matt Rollefson <email@hidden>
  • Date: Fri, 14 Dec 2001 16:15:50 -0800

Sounds like NSUndoManager is automatically using setTitleWithMnemonic: instead of just setTitle:. Here's the documentation from NSMenuItem:

setTitleWithMnemonic:

- (void)setTitleWithMnemonic:(NSString *)aString

Deprecated. Sets the title of a menu item with a character denoting an access key . Use an ampersand character to mark the character (the one following the ampersand) to be designated. For example, the following message causes the 'c' in 'Receive' to be designated:

[aMenuItem setTitleWithMnemonic:NSLocalizedString(@"Re&ceive")];


See Also: - mnemonic, - setMnemonicLocation:


This API is from when OpenStep was available on Windows. It is no longer used by the system, but obviously has not yet been completely removed.

Rollie


On Friday, December 14, 2001, at 03:20 PM, Mason Mark wrote:

Howdy,

I sometimes need to ask my document's undo manager for the title of the undo and redo menu items. There are a couple documented methods, but they don't seem to work right to me:

[myUndoManager undoActionName]; // <- returns "Typing", correct
[myUndoManager undoMenuItemTitle]; // <- returns "&Undo typing", why the "&"?

Similarly:

[myUndoManager undoMenuTitleForUndoActionName:[myUndoManager undoActionName]]; // <- returns "&Undo Typing"


Does anybody know why it wants to give me the menu item titles prepended by an unwanted ampersand?

Our document class actually manages multiple undo managers, and so I need this information to set the menu title that is displayed to the user. Checking for the ampersand and removing it works, sure, but it makes me uneasy that I do not know why the ampersand appears, nor do I know how this might play out on non-English OS versions.

Anybody know what I'm missing? (Or is it just a bug?)

Thanks,

--
Mason
_______________________________________________
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.


  • Follow-Ups:
    • Re: NSUndoManager returns menu item titles with unwanted ampersand ("&Undo Typing")
      • From: Mason Mark <email@hidden>
References: 
 >NSUndoManager returns menu item titles with unwanted ampersand ("&Undo Typing") (From: Mason Mark <email@hidden>)

  • Prev by Date: Re: Mac OS X Icons Template
  • Next by Date: Re: Totally off topic but not sure where to start (Smith, Bradley)
  • Previous by thread: NSUndoManager returns menu item titles with unwanted ampersand ("&Undo Typing")
  • Next by thread: Re: NSUndoManager returns menu item titles with unwanted ampersand ("&Undo Typing")
  • Index(es):
    • Date
    • Thread