Re: NSTextView insertText & undo
Re: NSTextView insertText & undo
- Subject: Re: NSTextView insertText & undo
- From: Douglas Davidson <email@hidden>
- Date: Thu, 26 May 2005 15:07:31 -0700
On May 26, 2005, at 2:58 PM, Glen Simmons wrote: 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 doesn't sound quite right. First, insertText: is the funnel point for user typing of characters; it does shouldChangeText... itself. Second, if you are actually inserting or deleting text, the replacement string should not be nil; a nil replacement string is for attribute changes. Third, you probably don't want to catch this at keyDown:, unless you really are defining the keys that you are looking for in terms of raw key strokes.
What keys are you catching, and what is the goal here?
Douglas Davidson
|
_______________________________________________
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