FROM : Lachlan Cotter
DATE : Mon Jan 14 09:27:55 2008
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
DATE : Mon Jan 14 09:27:55 2008
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
| Related mails | Author | Date |
|---|---|---|
| Lachlan Cotter | Jan 11, 23:22 | |
| Mike Abdullah | Jan 11, 23:46 | |
| mmalc crawford | Jan 11, 23:52 | |
| Lachlan Cotter | Jan 14, 09:27 |






Cocoa mail archive

