• 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
[SOLVED] How to receive text color changes from NSFontPanel?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SOLVED] How to receive text color changes from NSFontPanel?


  • Subject: [SOLVED] How to receive text color changes from NSFontPanel?
  • From: Schwill Daniel <email@hidden>
  • Date: Sat, 14 Oct 2006 16:03:08 +0200

Hi Martin,

Yes, changeAttribute: is sent to the first responder.

Maybe a little note in the NSFontPanel documentation would be nice. ;-)

Thanks!

   Daniel

Am 13.10.2006 um 20:20 schrieb Martin:

The NSFontPanel has a control to change the text color, but how can I
receive a change of the text color from the NSFontPanel?

I believe the first responder is sent "changeAttributes:", which is documented in the NSTextView reference. The general gist is that you want to call "convertAttributes:" on the sender, eg:


- (void) changeAttributes:(id)sender
{
NSDictionary* oldAttrs = [self currentAttributes];
NSDictionary* newAttrs = [sender convertAttributes:oldAttrs]; // adds color attribute
[self setCurrentAttributes:newAttrs];
}


If the NSColorPanel was brought up independently of the text view, then I think you'll receive "changeColor:" instead of "changeAttributes:".

I hope that helps,
~Martin



_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: How to receive text color changes from NSFontPanel? (From: "Martin" <email@hidden>)

  • Prev by Date: Problems with hitTest and mouseDown in my subview.
  • Next by Date: Re: Core Data: different fetch performance when launching app [SOLVED]
  • Previous by thread: Re: How to receive text color changes from NSFontPanel?
  • Next by thread: Table column width not integer, fuzzy headers
  • Index(es):
    • Date
    • Thread