Re: NSColorPanel flat out lies
Re: NSColorPanel flat out lies
- Subject: Re: NSColorPanel flat out lies
- From: Cathy Shive <email@hidden>
- Date: Wed, 27 May 2009 07:18:39 +0200
Hi Seth,
I have a subclass of NSColorWell that broadcasts a
"ColorWellDidBecomeActive" notification on "activate:".
Objects using the color panel listen for the notification and set some
internal flag so that they can either ignore the "changeColor" message
or not depending on which color well sent the notification.
Kind of sucky work-around but maybe something like this could help you
in your situation.
Best,
Cathy
On 27 May 2009, at 2:11AM, Seth Willits wrote:
I have a color well, which I am clicking on, and whenever I change
the color in the color panel, the color panel sends a changeColor:
message down the responder chain. Every time.
I *don't* want this, because it's sending changeColor to the wrong
object. It's a bit long-winded to explain, but it boils down to the
fact that I have this color well bound to a color property in a
model object and I don't want any actions sent.
So I read the docs:
"When you select a color in the color panel, NSColorPanel sends its
action to its target, provided that neither the action nor the
target is nil."
Ok, so I figured the color panel must have changeColor: set as its
action. I went to inspect what it was set to but... YOU CAN'T. There
is no -target or -action method in NSColorPanel. *lovely*. So I
tried setting both to nil in my controller, and tried it again...
Same deal. changeColor: is being called.
So I figured it must be the color well which is setting the action
when the color well becomes active. So I created a custom color well
subclass, and did:
- (void)activate:(BOOL)exclusive;
{
[super activate:exclusive];
[[NSColorPanel sharedColorPanel] setTarget:nil];
[[NSColorPanel sharedColorPanel] setAction:nil];
}
... which should hopefully fix the problem. It doesn't. changeColor:
is *STILL* called.
What the heck do I have to do to make it NOT send an action message?
--
Seth Willits
_______________________________________________
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
_______________________________________________
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