Re: NSTextView and changing the selected text's color
Re: NSTextView and changing the selected text's color
- Subject: Re: NSTextView and changing the selected text's color
- From: "Mattias Arrelid" <email@hidden>
- Date: Wed, 11 Jun 2008 18:15:27 +0200
Hi Douglas,
On Wed, Jun 11, 2008 at 5:30 PM, Douglas Davidson <email@hidden> wrote:
>
> On Jun 11, 2008, at 3:24 AM, Mattias Arrelid wrote:
>
>> Haven't anyone stumbled upon something similar, or a solution to this?
>
> I believe it was answered. You don't want to use setMarkedTextAttributes:,
> because marked text is the uncommitted text you see while using an input
> method. You can use setSelectedTextAttributes: instead.
It seems that I forgot to mention that I've tried that without
success. I can successfully set the background color of the selection
using this (in the initWithFrame: method of my custom text view):
NSMutableDictionary *dict = [[[self selectedTextAttributes]
mutableCopy] autorelease];
[dict setObject:[NSColor redColor] forKey:NSBackgroundColorAttributeName];
[self setSelectedTextAttributes:dict];
Now, any selected text will have a red background selection. Changing
the NSBackgroundColorAttributeName attribute to
NSForegroundColorAttributeName makes the selection background color
the system's default again, but doesn't affect the color of the
selected text.
Am I missing something here?
Regards
Mattias
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden