Re: Undo/redo for NSTextView appearing in a sheet dialog
Re: Undo/redo for NSTextView appearing in a sheet dialog
- Subject: Re: Undo/redo for NSTextView appearing in a sheet dialog
- From: Bill Cheeseman <email@hidden>
- Date: Sat, 06 Nov 2004 05:58:03 -0500
on 2004-11-05 6:23 PM, Mark Alldritt at email@hidden wrote:
> I want to have a panel (sheet) that displays a NSTextView. This text view
> is used to edit a (possibly long) block of descriptive text. The problem is
> that I cannot figure out how best to get Undo/Redo working while the panel
> is open. I don't want these undo/redo actions to be recorded against the
> NSDocument subclass instance that has presented the panel.
>
> I've read Bill C.'s Cocoa Recipes and lengths he has to go to to get
> undo/redo working for NSTextField seem overkill. Is there some easier means
> of getting NSTextView to "do the right thing" in a panel?
Text _fields_ and text _views_ are different when it comes to undo/redo. The
main difference is that you can simply turn on undo/redo in a text view in
Interface Builder and it works, while you have to do something more in
addition to that to make "live" undo/redo work correctly in a text field. My
Recipe 7 was designed only to deal with the text _field_ problem.
My Recipes 16 and 17 describe how to implement a text _view_ in a drawer,
with undo/redo.
However, keeping the text view's undo/redo separate from NSDocument's
undo/redo may be a bit trickier. If I recall correctly, you will have to
create a separate undo manager instance, similar to part of what Recipe 7
describes.
--
Bill Cheeseman - email@hidden
PLEASE NOTE NEW E-MAIL ADDRESS!
_______________________________________________
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