• 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: How do you allow highlighted (selected) areas to change vs the ENTIRE view?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextView: How do you allow highlighted (selected) areas to change vs the ENTIRE view?


  • Subject: Re: NSTextView: How do you allow highlighted (selected) areas to change vs the ENTIRE view?
  • From: Douglas Davidson <email@hidden>
  • Date: Wed, 25 Jan 2006 14:47:18 -0800


On Jan 25, 2006, at 2:35 PM, Frederick C. Lee wrote:

How do you allow a highlighted/selected area within an entire NSTextView to change versus solely the entire NSTextView?

I can't change a highlighted area within a NSTextView; only the ENTIRE view is changed (color, font characteristic, etc.).

Is there a flag or something to set?


Generally speaking, you obtain the rangesForUserTextChange, rangesForUserCharacterAttributeChange, or rangesForUserParagraphAttributeChange, depending on what you're doing, and then modify those ranges in the text storage.


Sequences of changes should be surrounded by beginEditing/endEditing calls. If the change represents user action, it should be preceded by a call to shouldChangeTextInRanges:replacementStrings: (and fail if that returns NO) and be followed by a call to textDidChange. For many user actions, it's also appropriate to change the typing attributes.

If that sounds a bit complicated, you can always make use of changeAttributes:, supplying a sender that implements convertAttributes: to behave as described in the NSFontManager documentation. That will handle all of the above for you automatically.

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: How do you allow highlighted (selected) areas to change vs the ENTIRE view?
      • From: Joshua Scott Emmons <email@hidden>
References: 
 >NSTextView: How do you allow highlighted (selected) areas to change vs the ENTIRE view? (From: "Frederick C. Lee" <email@hidden>)

  • Prev by Date: filtering in NSTreeController
  • Next by Date: Re: NSTextView: How do you allow highlighted (selected) areas to change vs the ENTIRE view?
  • Previous by thread: NSTextView: How do you allow highlighted (selected) areas to change vs the ENTIRE view?
  • Next by thread: Re: NSTextView: How do you allow highlighted (selected) areas to change vs the ENTIRE view?
  • Index(es):
    • Date
    • Thread