Re: PoseAsClass and NSColorWell (what Apple giveth, Apple taketh away...)
Re: PoseAsClass and NSColorWell (what Apple giveth, Apple taketh away...)
- Subject: Re: PoseAsClass and NSColorWell (what Apple giveth, Apple taketh away...)
- From: glenn andreas <email@hidden>
- Date: Fri, 28 Mar 2008 09:13:19 -0500
On Mar 28, 2008, at 7:14 AM, Graham Cox wrote:
Looking through the latest docs I see that as of 10.5, +poseAsClass
has been deprecated.
This gives me a problem which it previously solved quite neatly.
Perhaps someone can help me figure out a different solution...
NSColorWell is a handy widget, and it has the useful ability to
automatically deselect other instances application-wide when the
user selects a particular instance (only one on at a time).
I have a similar widget which can also be the target of
NSColorPanel, but it is used for setting the colour of a colour stop
in a gradient-manipulation user interface. The entire gradient
control is an NSControl subclass, but each colour stop "part" of the
control is just something I draw as part of the control's overall
content. It is not practical to make each stop a subclass of
NSColorWell, at least I don't think it is...
I've seen this exact problem in several different cases as well (both
a gradient editor as well as "something that can be the target of a
color panel but isn't a color well").
One approach is to manually walk your UI and deactivate any color
wells it finds - it's kind of brute force, but it does work (just
remember that besides walking the subviews of a view, you need to look
in tab items of an NSTabView).
Another (easier) work around is to make a dummy NSColorWell, located
off the edge of the window, and then activate that. You can then
either immediately deselect it (so your widget will be the only thing
listening to the color panel) or you can use it to forward color
changes to your widget by making it the target of the color well...
Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
Cardographer | the custom playing card designer
_______________________________________________
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