Re: Undoable controls
Re: Undoable controls
- Subject: Re: Undoable controls
- From: Frode <email@hidden>
- Date: Thu, 8 Sep 2005 20:48:12 +0200
2005-09-08 kl. 12.40 skrev Bill Cheeseman:
The issue of "live" undo in a text field is more complicated. This has
to do
with getting an "Undo Typing" menu item every time you edit the text
within
a text field that has not yet been committed. In a practical sense,
live
undo of text fields was not available prior to Tiger, but it is
available
and turned on by default in Tiger.
What about implementing the pre-Tiger undo mechanism from the
textStorageWillProcessEditing-notification of NSTextStorage, perhaps
with the aid of controlTextBeginEdit and controlTextEndEdit? (Or using
NSTextView's undoer with the aid of beginEditing/endEditing) And this
is essentially in the model layer! Everybody satisfied :-)
NSTextStorage.h-header states that it "implements change management
(beginEditing/endEditing)", but I can find whether it sends out a
generetic beginEditing/endEditing notification, or whether it's just a
terminologi for what -edited:range:changeInLength: does. I guess
-edited:range:changeInLength: is called from a hidden event function,
not shown to us.
(Hmm... At first glance, it looks like textStorageWillProcessEditing is
called AFTER the string has been modified, so there is no access to the
old data. However, I will check this further.)
In my book "Cocoa Recipes for Mac OS X: The Vermont Recipes," I have a
short
chapter showing how you can implement live undo in text fields prior to
Tiger. It works much better than simply turning on the field editor's
can
undo flag, but it still has some problems that, in my post-publication
opinion, make it unusable as a practical matter.
Actually, I have considered bying your book! :-)
I'm working on my first Cocoa project and mixing alot of C++ code. My
main knowledge about Cocoa is essentially from the great Apple
documentation (including header files). And, of course, from lists
including this, too.
Regards,
Roger
_______________________________________________
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