Re: NSUndoManager in a multiwindow document
Re: NSUndoManager in a multiwindow document
- Subject: Re: NSUndoManager in a multiwindow document
- From: Dustin Voss <email@hidden>
- Date: Wed, 16 Oct 2002 23:29:26 -0700
On Friday, October 11, 2002, at 06:39 PM, Greg Hulands wrote:
Hi,
I have a document based application that has its main view as an
"overview" of the documents parts. Each part when clicked opens an
editor, that allows the part to be changed. I have the NSUndoManager
for the overview window which i access through the editor so that
colours, locations of display primitives can be undone redone. The
undo's get put into the NSUndoManager, but the menu options in the
edit menu are not active as if my editor window cannot handle undo
redo actions.
How is the best way to handle the undo redo actions so that my editor
window can validate them. Should I just put it in the editor's view to
handle the undo redo as it has the first responder or is there a more
elegant solution?
Any informations / tips / pointers are greatly appreciated.
I'd say that you should only have one NSUndoManager. To the user,
undoing is more an app-wide thing than a window-specific thing. If you
use multiple NSUndoManagers, the undo stack changes whenever the user
switches windows. The NSUndoManager is typically owned by the document,
if I understand Cocoa properly.
What's wrong with simply implementing NSWindowWillReturnUndoManager:
(or whatever that method is called) for each of your windows?
Now, if you don't want to do that for some reason, you can implement
the validateMenuItem: and undo: methods in the application delegate.
That way, you wouldn't have to do anything special in each of the
windows.
But since that seems too easy, and I'm weary, I just know I'm missing
something here...
_______________________________________________
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.