• 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
NSColorPanel, and de-registering objects from them
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSColorPanel, and de-registering objects from them


  • Subject: NSColorPanel, and de-registering objects from them
  • From: Ken Tabb <email@hidden>
  • Date: Fri, 11 Jun 2004 16:02:31 +0100

Hi again folks,

I have an NSButton subclass which attempts to mimic NSColorWell (it does other things too so can't be a subclass of NSColorWell, unfortunately).

In order to bring about the shared color panel and to be told about the colours being selected in it, I get my button to:

[[NSColorPanel sharedColorPanel] setTarget:self];
[[NSColorPanel sharedColorPanel] setAction:@selector(changeTheColour)];

... and this works fine, as per the installed docs. The trouble is that if the user click on a real NSColorWell, elsewhere in the window, the NSColorPanel starts sending both the NSColorWell and my button the colours, so they both start changing at once! It makes for very psychadelic interfaces, but isn't very useful to me (or the users I'm guessing). Clicking the real NSColorWell again seems to unregister it from being told to change colour, so maybe I just need to mimic that bit in my button. But the docs don't seem to say how you'd do that, and my button is modeless, so if the answer is [sharedColorPanel setTarget:nil], then it wouldn't know when to call that 8^(

If I don't call the above code, my button doesn't know to change colour, so brings the colour panel up, but that's it.

The only sample code I've found uses "real" NSColorWells to do the work, so is of limited help to me in this case.

Methinks I'm missing something here! Please be merciful in your mocking of me...

Ken


- - - - - - - - - -
Dr. Ken Tabb
Mac & UNIX Technical bloke (C, C++, Obj-C, Java) - Health & Human Sciences
Machine Vision & Neural Network researcher bloke - Computer Science Dept
University of Hertfordshire, UK
http://www.health.herts.ac.uk/ken/

Certified non-Microsoft Solution Provider
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Prev by Date: Re: Mail.app TextView Question
  • Next by Date: Re: POST request without NSURLConnection
  • Previous by thread: Re: Mail.app TextView Question
  • Next by thread: NSFontPanel mode change triggers faulty update?
  • Index(es):
    • Date
    • Thread