RE: How to receive events fro NSColorWell
RE: How to receive events fro NSColorWell
- Subject: RE: How to receive events fro NSColorWell
- From: Vinay Prabhu <email@hidden>
- Date: Thu, 11 May 2006 18:33:46 +0530
- Importance: Normal
Hi Savant,
Thanks for the help.
I have implemented as you said it worked.
Even I have tried one more method.
I have created a subclass of NSColorWell, and connected the color well from
window to the
instance of the sub class using the "takeColorFrom" function. That's also
works
Regards
Vinci
-----Original Message-----
From: I. Savant [mailto:email@hidden]
Sent: Thursday, May 11, 2006 6:17 PM
To: Vinci
Cc: email@hidden
Subject: Re: How to receive events fro NSColorWell
Vinci:
NSColorWell is a subclass of NSControl. It has a target and an
action. Changing the color with the color well follows the "target /
action" pattern. If you're setting it up in Interface Builder, you'd
set it up exactly as any other button - drag a connection from the
color well to the controller and connect it to an action.
Say your controller is an NSDocument subclass. In this document
you want to change the color of some object when the well is changed.
In your document's implementation you'd have something like the
following:
- (IBAction)changeColor:(id)sender
{
[someObjectWhoseColorYouWantToChange setColor:[sender color]];
}
In IB, you drag a connection from the color well to your document
and connect it to the -changeColor: action. When the well's color
changes, it will send your NSDocument subclass the -changeColor:
message, passing itself (the well) as the "sender". You can then ask
the sender for its -color and do with it what you please.
Of course this is greatly simplified using Cocoa Bindings but the
above is considered "Cocoa basics". Bindings are a little more of a
challenge to understand at first. For a good lesson in Cocoa, see:
http://developer.apple.com/documentation/Cocoa/Conceptual/
ObjCTutorial/index.html
For a good lesson in Cocoa Bindings, see:
http://developer.apple.com/documentation/Cocoa/Conceptual/
CocoaBindings/index.html
I hope this helps.
--
I.S.
On May 11, 2006, at 4:19 AM, Vinay Prabhu wrote:
> Hi,
>
> How we can receive the events for NSColorWell.
> Also, how to receive the color information after, we change the
> color in the
> NSColorWell.
>
> -Vinci
>
> The information contained in this electronic message and any
> attachments to this message are intended for the exclusive use of
> the addressee(s)and may contain confidential or privileged
> information. If you are not the intended recipient, please notify
> the sender or email@hidden
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> 40gmail.com
>
> This email sent to email@hidden
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s)and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender or email@hidden
_______________________________________________
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