Re: How to associate a view with Color Panel
Re: How to associate a view with Color Panel
- Subject: Re: How to associate a view with Color Panel
- From: "M. Uli Kusterer" <email@hidden>
- Date: Fri, 5 Nov 2004 02:11:39 +0100
At 13:50 Uhr -0600 04.11.2004, Todd Yandell wrote:
- (void)changeColor:(id)colorPanel
{
[self setNeedsDisplay:YES];
}
- (void)drawRect:(NSRect)rect
{
[[[NSColorPanel sharedColorPanel] color] set];
[[NSBezierPath bezierPathWithRect:rect] fill];
}
One note: That's not really how NSColorPanel seems to be intended to
be used IMHO. You should rather have some object that keeps a copy of
the current color, and have that object send out notifications
whenever its color is changed.
The usual way the color panel is used, IIRC, is to have it send its
message to up the responder chain. You'll want to do that as well.
Otherwise, whenever someone selects some text in a text view and
changes its color, your line will get the message instead and change
its color.
At least that's the theory. I've yet to get back to my drawing code
and get re-acquainted with NSColorPanel.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden