sharedColorPanel question
sharedColorPanel question
- Subject: sharedColorPanel question
- From: Aaron Boothello <email@hidden>
- Date: Fri, 2 Mar 2007 11:01:10 +0900
I use a contextual menu to bring up the shared color panel in order
to change a particular attribute in my application. the code is as
follows....
//-----------
- (IBAction)changeBackgroundColor:(id)sender
{
[[NSColorPanel sharedColorPanel] makeKeyAndOrderFront:self];
[[NSColorPanel sharedColorPanel] setTarget: self];
[[NSColorPanel sharedColorPanel] setAction:@selector
(changeColor:)];
}
-(void)changeColor:(id)sender
{
float colors[4];
colors[0]= [[[sender color] retain] redComponent];
colors[1]= [[[sender color] retain] greenComponent];
colors[2]= [[[sender color] retain] blueComponent];
colors[3]= [[[sender color] retain] alphaComponent];
}
//-------------
The problem arises when, in another part of the application, i use a
colorWell to change the color of another attribute. the target and
action remain unchanged(as above), and so these two different colors
change simultaneously. How do i correct this ?
Thanks,
Aaron
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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