NSColorPanel flat out lies
NSColorPanel flat out lies
- Subject: NSColorPanel flat out lies
- From: Seth Willits <email@hidden>
- Date: Tue, 26 May 2009 17:11:28 -0700
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