• 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
Re: NSTextView and changing the selected text's color
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: NSTextView and changing the selected text's color
      • From: "Mattias Arrelid" <email@hidden>
References: 
 >Fwd: NSTextView and changing the selected text's color (From: "Mattias Arrelid" <email@hidden>)
 >Re: NSTextView and changing the selected text's color (From: Douglas Davidson <email@hidden>)

  • Prev by Date: Re: Link to zlib
  • Next by Date: Re: Mail Rule Actions Control
  • Previous by thread: Re: NSTextView and changing the selected text's color
  • Next by thread: Re: NSTextView and changing the selected text's color
  • Index(es):
    • Date
    • Thread