Hello Cocoa-devs,

I've a got an out-of-the box NSTextField that I'm trying to apply various 
string attributes to, including colors. I'm not using the standard color panel, 
since the application I'm writing can only support a very limited set of 
colors, so I just have a menu with a list of colors. So far, the user can 
select text in the field, click (or press a keyboard shortcut for) one of the 
menu items, and the selected text will change colors (via NSText's - 
setTextColor: range: method.) If the field is empty, the user can also choose 
one of the menu items and any text he or she types will appear in the selected 
color.

My question is this: let's say my user has already typed some text in black (or 
whatever color) and now wants to change the "active color" of the text at the 
insertion point, such that any text he or she types appears in the new color. 
I've tried calling - setTextColor: range: with range: being the end of the 
string, but this appears to do nothing.

I'm sure this should be possible, because the standard NSColorPanel allows you 
to do this (as long as the field is set to use rich text, which mine is.) 
Google shows me a couple ways to change the color of the insertion point 
itself, but not the color of the text at the insertion point.

Anyone know how to do this?

Thanks in advance,
- Alex_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to