Re: NSTextView multiple selection colors
Re: NSTextView multiple selection colors
- Subject: Re: NSTextView multiple selection colors
- From: Douglas Davidson <email@hidden>
- Date: Tue, 28 May 2002 10:35:37 -0700
On Saturday, May 25, 2002, at 10:45 PM, Eric Blenkush wrote:
Is there a way to select text in a NSTextView and have the selection be
multiple colors? For example if two words are selected and the color of
the highlighting on the first word is blue and on the second word the
color is red. I looked in the docs and on these lists but didnt find
anything obvious, hopefully I just missed it.
There is no stock way to do this; the selection attributes can be set,
but it is a single set of attributes, not one per word. However, it
probably would be possible to do something like this programmatically.
I would suggest using temporary attributes in the layout manager to set
the colors. You would need to check and possibly recolor the text
whenever the selection or the text changed; you can obtain notices of
user changes as the text view's delegate, or you could subclass
NSTextView to hear about all changes. I should be coming out with an
example of using temporary attributes for coloring fairly soon.
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.