On 18/01/2013, at 11:13 AM, Andy Lee <ag...@mac.com> wrote:

> The OP actually wants to *suppress* changing of color. But good to know.


Yep, I misremembered - helps to actually re-read the OPs message before 
commenting... :|

However, it does incidentally solve that problem, in most cases, because the 
messages to FR are passed on to the object that is actually causing the change 
in the first place, and so it can be ignored. The main problem I've run into 
with that is that there can be "colateral damage", in that if you have a 
multiple selection and other objects can respond to -changeColor:, or you have 
unrelated colorwells selected, they can suddenly find themselves set to the 
colour of the newly clicked object.

I think the underlying problem is that the color panel is designed primarily as 
an input device, used to SET a colour property of an object which in turn is 
expected to be represented by a colorwell. There are many other use-cases but 
these appear to be afterthoughts and the color-well situation takes priority. A 
typical case is when you want to set the colour of a chunk of selected text. 
That can be done easily by responding to the color panel, but if there's a 
selected colorwell anywhere, that gets that colour as well, which may supply 
the same colour to some totally unrelated object. Since that can be anywhere in 
your app's interface, it's not always obvious that this accidental 
synchronisation has taken place. There is no API to get the "current" colorwell 
to turn it off, or to turn all of them off at once, to prevent this. I've coded 
solutions to that myself by creating an object with a dummy invisible colorwell 
that I can select, which causes all others to be deselected so I can get the 
exclusive attention of the color panel.

The final problem, which as I understand it is the OP's, is that if you want to 
use the color panel as an output device, to display the colour of something 
selected, you must take steps to redirect its action to a dummy target to 
prevent it sending up the responder chain, AND to turn off any colorwells that 
might be active to prevent them receiving the change as well, causing the same 
copying of a colour from one object to something completely unrelated via a 
colorwell. The same solution (an object with a dummy invisible colorwell) 
solves this too allowing you to turn off all other colorwells.

--Graham



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to