1

I have a view that handles undo and redo. For a specific state I change first responder from the view to the view's window. Now in that state I expect the validateMenuItem: method in the window's delegate to check the undo menu item.

This works when I close the window. But when the window is visible some other responder deals with the undo action.

My guess is that it's the window controller? But as this is a non-document based app I haven't implemented one manually. Will I have to create a custom window controller? And if so, what's the simplest way to do that?

1 Answer 1

2

Found the answer here: http://www.cocoabuilder.com/archive/cocoa/307917-validatemenuitem-not-called-for-undo-menu-item.html

Configuring the Undo menu item with action 'undo:' tells the frameworks that this is the undo menu item, so it becomes one element of a standard undo UI mechanism implemented in NSWindow. Under these circumstances, the menu item (and especially its validation) isn't yours to mess with.

If you want to take implement the entire mechanism yourself, then you should use a custom action such as 'myUndo:' for the Undo menu item. That means, as far as the frameworks know, you app doesn't have (standard) undo, and the action/validation should work in the normal way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.