• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSTextView insertText & undo
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTextView insertText & undo


  • Subject: NSTextView insertText & undo
  • From: Glen Simmons <email@hidden>
  • Date: Thu, 26 May 2005 16:58:50 -0500

I'm "translating" keys that are entered in an NSTextView subclass into images by:
1. catching the key in -[MyTextView keyDown:]
2. creating an NSAttributedString with an NSTextAttachment
3. calling:
[myTextView shouldChangeTextInRange:[myTextView rangeForUserTextChange] replacementString:nil]
[myTextView insertText:theAttrStr];
[myTextView didChangeText];


This works fine, except that undo doesn't work in one particular case: After entering one or more characters, I hit backspace once and then try to undo. Undo appears to do nothing. My guess is that the backspace is getting missed by the undo manager, so it's undoing what it thinks is the last action, the insertion of the character, which gives the same result as the undo, so it looks like nothing happened.

So, what am I missing?

Thanks,
Glen
_______________________________________________
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


  • Follow-Ups:
    • Re: NSTextView insertText & undo
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: Re: NSBrowser/NSMatrix as drag-and-drop source
  • Next by Date: Stupid newbie question...
  • Previous by thread: [SOLVED] Re: NSBrowser/NSMatrix as drag-and-drop source
  • Next by thread: Re: NSTextView insertText & undo
  • Index(es):
    • Date
    • Thread