Re: NSColorWell / NSColorPanel
Re: NSColorWell / NSColorPanel
- Subject: Re: NSColorWell / NSColorPanel
- From: Graham Cox <email@hidden>
- Date: Sat, 04 Feb 2012 16:18:23 +1100
On 04/02/2012, at 11:08 AM, koko wrote:
> In a modal panel I have a NSColorWell. Clicking the NSColorWell display a NSColorPanel.
>
> The NSColorPanel docs say that the method -(void)changeColor:(id)sender is sent to the first responder and that you can override this method in any responder that needs to respond to a color change.
>
> I have implemented this method in the class that is the file's owner for the modal panel which is a NSWindowController.
>
> The method -(void)changeColor:(id)sender is not called on a color change in the NSColorPanel.
>
> How do I get the method -(void)changeColor:(id)sender called.
Not that way, actually.
Since you have a colorwell, the colorwell will be hooked up to the color panel as long as it is selected. So just set the colorwell control's target and action to the desired handler and you will get the change. This is more reliable than relying on the color panel sending to the responder chain - I THINK it only does that when it doesn't have a specific colorwell to talk to (if it did, you'd likely get mutliple colour changes in unrelated parts of the app). The mechanism you describe is mostly useful when the key view can respond to a colour change as a whole.
--Graham
_______________________________________________
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