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: Thu, 12 Jun 2008 11:14:51 +0200
On Wed, Jun 11, 2008 at 6:15 PM, Mattias Arrelid <email@hidden> wrote:
> 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?
Just to test things; I did setup a simple test project, and in there
it works just fine setting the foreground color. Back to the debugger
to see where that call to setSelectedTextAttributes: is going.
Thanks again.
/ 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