Re: [SOLVED] How to receive text color changes from NSFontPanel?
Re: [SOLVED] How to receive text color changes from NSFontPanel?
- Subject: Re: [SOLVED] How to receive text color changes from NSFontPanel?
- From: Matt Neuburg <email@hidden>
- Date: Sat, 14 Oct 2006 11:42:31 -0700
- Thread-topic: [SOLVED] How to receive text color changes from NSFontPanel?
On Sat, 14 Oct 2006 16:03:08 +0200, Schwill Daniel <email@hidden>
said:
>Hi Martin,
>
>Yes, changeAttribute: is sent to the first responder.
<http://www.cocoabuilder.com/archive/message/cocoa/2004/9/1/116331>
>Maybe a little note in the NSFontPanel documentation would be nice. ;-)
If you think so, then file a bug on the docs. m.
>
>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
>>
>>
>
>
>
>
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
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