Re: Dynamically validating undo menu item availability (NSUndoManager)
Re: Dynamically validating undo menu item availability (NSUndoManager)
- Subject: Re: Dynamically validating undo menu item availability (NSUndoManager)
- From: Lachlan Cotter <email@hidden>
- Date: Mon, 14 Jan 2008 21:27:55 +1300
Thanks guys.
This seems to be half the solution... however there are still some
complications. I learned in this thread:
http://www.cocoabuilder.com/archive/message/cocoa/2002/8/8/55198
how to validate the undo menu item, which seems to require some
special treatment. But even though I'm now getting validateMenuItem:
called for the undo item, I can't see how I can tell what target is
on top of the undo stack in order to validate it.
It's not sufficient for me to just check the name of the undo item. I
need to get the undo target in order to call it's validation method.
NSUndoManager doesn't seem to have methods to check this.
Any ideas?
Incidentally, it looks like the undo item gets its special context
sensitive name somewhere inside NSWindow's implementation of
validateMenuItem: since overriding this method causes this
functionality to disappear. My solution is to call super's
implementation anyway but just ignore the result.
Cheers,
Lach
On 12/01/2008, at 11:52 AM, mmalc crawford wrote:
The -validateMenuItem: method in an appropriate controller should
do wonders.
You should typically use validateUserInterfaceItem: instead, unless
there's a good reason not to:
<http://developer.apple.com/documentation/Cocoa/Conceptual/
MenuList/Articles/EnablingMenuItems.html#//apple_ref/doc/uid/
20000261-74653>
mmalc
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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