Adding an undo method in textView:shouldChangeTextInRange:...
Adding an undo method in textView:shouldChangeTextInRange:...
- Subject: Adding an undo method in textView:shouldChangeTextInRange:...
- From: Keith Blount <email@hidden>
- Date: Thu, 13 Jan 2005 14:50:47 -0800 (PST)
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
Hello,
I have been stuck on this for nearly a week now and it
is driving me crazy - I would be really grateful for
any help or tips.
I have a custom view that does various things (mainly
move little note cards around) whenever an associated
text view's text is updated. This is done by setting
my custom view as the text view's delegate and acting
in textView:shouldChangeTextInRange:replacementString:
and textDidChange:. I am now trying to implement undo,
and when it comes to trying to undo the changes in my
custom view that were made in these methods, I am
hitting my head against a brick wall.
The most successful implementation I have tried is to
add an undo call to my custom view to
textView:shouldChangeTextInRange... with
prepareInvocationWithTarget: This works, but it messes
up the undo in the text view, in that it seems to
automatically end the text view's current undo group,
so that hitting Undo will only get rid of one typed
letter at a time - which would obviously exhaust and
annoy users. I guess what I really need is some way of
telling the undo manager to add my undo to the current
undo group, but there doesn't seem to be any obvious
way. I have tried listening for the various undo
notifications and trying to insert my undo there, but
that doesn't work either.
If any undo gurus out there could please give me some
help on this, I would be really thankful.
Many thanks in advance,
Keith
__________________________________
Do you Yahoo!?
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250
_______________________________________________
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