Re: undo text in an NSTextView
Re: undo text in an NSTextView
- Subject: Re: undo text in an NSTextView
- From: Nicky <email@hidden>
- Date: Mon, 9 Sep 2002 14:12:10 +0200
thank you for your reply!
We try to implement an endUndoGrouping, when going out of edit mode.
Unfortunately at that moment there was no beginUndoGrouping standing
open.
We also tried to open a beginUndoGrouping when going into edit mode and
an endUndoGrouping when going out.
This results in not being able to undo text while editing. Also we get
an extra undo in the menu without an operation and if we set a color,
it doesn't appear in the menu, so text and color is combined in one
undo menu item.
Does anyone have an idea where to put the beginUndoGrouping and the
endUndoGrouping for undoing "typing text" and keep automatic undo
grouping on for setting color, font etc..
Any help is welcome!
Nicky and Ruben
------------
I guess what you want is considered incorrect behavior. You get the
behavior
you want only if, when you go out of edit mode after typing "hello," you
type something in some other text view or click a checkbox -- anything
that
adds a new undo group to the undo stack. But if you "go out of edit
mode"
and don't do anything that adds a new group to the undo stack, then
when you
"return to edit mode" the undo manager thinks your original undo group
is
still open.
To get the behavior you want, I believe you would either have to roll
your
own text system undo code -- a major undertaking -- or implement some
delegate method that knows when focus has left the text view and, in the
delegate method, tell the undo manager to close the pending undo group
(if
there is one). I'm not sure how you would do that, but it might become
clear
from looking at the NSUndoManager class reference document. I imagine
endUndoGrouping is the method to play with.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
The AppleScript Sourcebook -
http://www.AppleScriptSourcebook.com
Vermont Recipes -
http://www.stepwise.com/Articles/VermontRecipes
Croquet Club of Vermont -
http://members.valley.net/croquetvermont
_______________________________________________
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.