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

Modifying the text attributes applied to an NSTextView


  • Subject: Modifying the text attributes applied to an NSTextView
  • From: Scott Thompson <email@hidden>
  • Date: Tue, 30 Mar 2004 15:39:18 -0600

I've run into another case with NSTextView where my understanding almost lets me do what I want to do, but not quite.

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.

I've found delegate routines like:

textView:shouldChangeTextInRange:replacementString:

That's a fine delegate method so long as you are interested in stopping the user from entering foul language or something. The method is even called if the attributes of the text change... Unfortunately I don't understand how you find out what attribute changes the user is trying to make.

I've read some other things in NSFontManager with changeFont: and similar methods. The set of calls that goes on between the text view and the font manager seem strange and bewildering to me. I think I just haven't read them quite enough. Nevertheless, there doesn't seem to be a way for the delegate to get in-between the current font manager and the text view to tweak the fonts as they are flying back and forth :-(

On a related note, is there any way to disable parts of the Font Panel? Another solution to my problem might be to say "hey... font panel, disable your font size controls". I couldn't see a "set the list of attributes the font panel is allowed to modify" method either.

I get the sense that what I am looking for is in here somewhere and I'm just not looking in the right place. Can anyone suggest where my blind spot might be?

Scott
_______________________________________________
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.


  • Follow-Ups:
    • Re: Modifying the text attributes applied to an NSTextView
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: Re: Accessing the FUS menu?
  • Next by Date: Re: NSDocument-based app limitations?
  • Previous by thread: Re: Documents and Projects
  • Next by thread: Re: Modifying the text attributes applied to an NSTextView
  • Index(es):
    • Date
    • Thread