Re: Re: Custom NSView and NSUndoManager
Re: Re: Custom NSView and NSUndoManager
- Subject: Re: Re: Custom NSView and NSUndoManager
- From: "Benjamin R. Dunton" <email@hidden>
- Date: Thu, 10 Nov 2005 10:32:37 -0500
Jim,
I'm getting closer. I have my window controller returning the windows
undoManager through windowWillReturnUndoManager:
[[self window] windowWillReturnWindowManager:[self window]]
I then assign a reference to this undo manager to my container view (My
container view holds the views that are moving, and is its self contained by an
NSScrollView). I put the undo action onto the undoManagers stack.
Now here is where the last hitch is. After I move the view, a check of the Edit
menu still has the Undo menu item disabled; however, if I click on the text
view in my window, Undo is enabled, and when command+z is performed,
the view is moved back properly.
What do I need to do to get the undo menu to become enabled when an undo
action is added, and I am not inside the text view.
Thanks,
Ben
>
> From: Jim Correia <email@hidden>
> Date: 2005/11/10 Thu AM 07:31:08 EST
> To: Benjamin Dunton <email@hidden>
> CC: email@hidden
> Subject: Re: Custom NSView and NSUndoManager
>
> On Nov 10, 2005, at 5:58 AM, Benjamin Dunton wrote:
>
> > I was thinking about this some more this morning, and with what you
> > are saying, tell me if this makes since. I have a text view in the
> > application as well, and after calling [self setAllowsUndo] in the
> > awakeFromNib:, undo/redo works. I am thinking that if I get the
> > undo manager from the text views delegate (which also happens to be
> > my window controller), that things might start working?
>
> Does your window controller own its own undo manager?
>
> If your window doesn't, it probably should at this point, and you
> should make yourself the window's delegate and return it from
>
> - (NSUndoManager *)windowWillReturnUndoManager:(NSWindow *)window;
>
>
> Jim
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden