• 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: Modifying the text attributes applied to an NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Modifying the text attributes applied to an NSTextView


  • Subject: Re: Modifying the text attributes applied to an NSTextView
  • From: Douglas Davidson <email@hidden>
  • Date: Tue, 30 Mar 2004 14:37:06 -0800

On Mar 30, 2004, at 1:39 PM, Scott Thompson wrote:

I've got a text view that is a "Rich Edit" view. What I'd like to do is allow pretty much the full range of text editing features for the text in that view EXCEPT no font size changes allowed (for example, you get 12 point text and you're going to like it!). Beyond that the user should feel free to change the font, the color etc... etc....

What I think I'd like to do is intercept the attributes before they are applied to the TextStorage, change any fonts entered so that they are 12 pt, then allow the attribute change to proceed as normal.

What I would suggest is that you allow the change to proceed as normal, then intervene afterwards to constrain the fonts as you desire. That will help you in the case that e.g. the user pastes in 24-point text. You should be able to do this with a combination of should-change and did-change delegate methods--for example, you can make a note of the range that is changing in the should-change method and then use that information in the did-change method. You will have to modify the range to take into account any change in length if there is a replacement string and it is not the same length as the range being modified.

Douglas Davidson
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Modifying the text attributes applied to an NSTextView (From: Scott Thompson <email@hidden>)

  • Prev by Date: Re: BEST BOOK FOR LEARNING COCOA
  • Next by Date: setting window style attributes in a nib
  • Previous by thread: Modifying the text attributes applied to an NSTextView
  • Next by thread: graphs, pie and charts
  • Index(es):
    • Date
    • Thread