• 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
Re: NSTextView insertText & undo
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: NSTextView insertText & undo
      • From: Glen Simmons <email@hidden>
References: 
 >NSTextView insertText & undo (From: Glen Simmons <email@hidden>)

  • Prev by Date: Re: NSBrowser/NSMatrix as drag-and-drop source
  • Next by Date: Re: Stupid newbie question...
  • Previous by thread: NSTextView insertText & undo
  • Next by thread: Re: NSTextView insertText & undo
  • Index(es):
    • Date
    • Thread