• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to associate a view with Color Panel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >How to associate a view with Color Panel (From: Fei Li <email@hidden>)
 >Re: How to associate a view with Color Panel (From: Todd Yandell <email@hidden>)

  • Prev by Date: Re: Why not a procedure for retain/release?
  • Next by Date: Re: why no autosave for NSSplitView?
  • Previous by thread: Re: How to associate a view with Color Panel
  • Next by thread: Sheets and hidden apps
  • Index(es):
    • Date
    • Thread