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 protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to