Re: How to receive text color changes from NSFontPanel?
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