Re: NSUndoManager returns menu item titles with unwanted ampersand ("&Undo Typing")
Re: NSUndoManager returns menu item titles with unwanted ampersand ("&Undo Typing")
- Subject: Re: NSUndoManager returns menu item titles with unwanted ampersand ("&Undo Typing")
- From: Mason Mark <email@hidden>
- Date: Fri, 14 Dec 2001 17:12:20 -0800
OK, cool. I thought it must be something like that.
Since -[NSUndoManager undoMenuTitleForUndoActionName:] returns a string
rather than a menu item, and since the ampersand is no longer of value,
it seems like a small bug to me.
In the meantime, all I am doing with that information is setting a menu
item title. So rather than removing the ampersand, I can just use
-setTitleWithMnemonic: to set the title instead of using -setTitle:.
(There don't seem to be any problems with that even if the new title
string does not contain the ampersand.)
Thanks again,
--
Mason
On Friday, December 14, 2001, at 04:15 PM, Matt Rollefson wrote:
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.
_______________________________________________
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.