• 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: NSColorWell----please help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSColorWell----please help


  • Subject: Re: NSColorWell----please help
  • From: Martin Wierschin <email@hidden>
  • Date: Wed, 7 Jan 2009 01:55:08 -0800

After activating the colorwell ,if we select any colors from that colorwell
The backgroundcolor changes and the foregroundcolor changes to the same
color if we type.

As mentioned, the easiest is to override "changeColor:" in a NSTextView subclass. Others have done it:


	http://www.cocoabuilder.com/archive/message/cocoa/2007/12/13/194848

I want the colorwell to act ,only when any color from it is selected,
Not at the time of activation .

This is an annoyance of NSColorWell, and my solution was to create a NSColorWell subclass that overrides "activate:" to set a flag you can test later to ignore the "changeColor:" action, eg:


@implementation MYColorWell

- (void) activate:(BOOL)isExcl
{
	// the very first click on a color well normally sends its action
	[NSColorPanel beginDisableAllColorActions];
	[super activate:isExcl];
	[NSColorPanel endDisableAllColorActions];
}

@end

It's not pretty, but the color panel is a shared resource anyways, and it does the job.

~Martin

_______________________________________________

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


References: 
 >NSColorWell----please help (From: rethish <email@hidden>)

  • Prev by Date: NSColorWell----please help
  • Next by Date: Re: Using the security framework
  • Previous by thread: NSColorWell----please help
  • Next by thread: Parsing XML from a Https URL using NSXMLParser?
  • Index(es):
    • Date
    • Thread