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

Re: How to receive text color changes from NSFontPanel?


  • Subject: Re: How to receive text color changes from NSFontPanel?
  • From: "Martin" <email@hidden>
  • Date: Fri, 13 Oct 2006 11:20:56 -0700

>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

  • Follow-Ups:
    • [SOLVED] How to receive text color changes from NSFontPanel?
      • From: Schwill Daniel <email@hidden>
  • Prev by Date: Re: Two different fonts for the two lines which are displayed in the same row and column
  • Next by Date: Re: Tracking frontmost App
  • Previous by thread: How to receive text color changes from NSFontPanel?
  • Next by thread: [SOLVED] How to receive text color changes from NSFontPanel?
  • Index(es):
    • Date
    • Thread