Re: NSColorPanel flat out lies
Re: NSColorPanel flat out lies
- Subject: Re: NSColorPanel flat out lies
- From: Seth Willits <email@hidden>
- Date: Tue, 26 May 2009 19:06:57 -0700
On May 26, 2009, at 6:15 PM, Graham Cox 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.
If your color well is first responder, then it can swallow the -
changeColor: message. If it isn't then it shouldn't be responding to
the color panel anyway?
Color wells don't become first responder when you click on them. They
just become "active". Stick a color well on a window next to a text
view. The text view always remains first responder when you click on
the color well.
On May 26, 2009, at 5:58 PM, Alexander Heinz wrote:
You might try sending setContinous:NO to the color panel.
Nope. That simply changes whether the color is changed while the user
drags the mouse in the color picker. changeColor: is still sent at the
beginning and end.
Also, setting the NSColorPanel's target and selector to a valid object
and selector, that action is called in *addition* to changeColor:. So
it seems NSColorPanel will always send changeColor: up the responder
chain AND then call the action on the specified target/selector
according to the rules in the docs.
I actually just found this being described in a subsection of the
color programming guide. changeColor: is also in the color panel's
reference, but it's listed under Delegate Methods and simply has a
note saying it's sent to first responder, not a designated delegate.
So... my bad.
I really don't like the design of NSColorPanel and NSFontPanel. It's
not like I can come up with an undeniably better architecture, but the
existing ones sure do have some major annoyances whenever I need to
use them.
I'll have to rethink this some more.
--
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