• 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: How to receive events fro NSColorWell
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to receive events fro NSColorWell


  • Subject: Re: How to receive events fro NSColorWell
  • From: "I. Savant" <email@hidden>
  • Date: Thu, 11 May 2006 08:46:33 -0400

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

_______________________________________________ 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
  • Follow-Ups:
    • RE: How to receive events fro NSColorWell
      • From: Vinay Prabhu <email@hidden>
References: 
 >How to receive events fro NSColorWell (From: Vinay Prabhu <email@hidden>)

  • Prev by Date: Suppressing highlight drawing in an NSTableView
  • Next by Date: Re: Programmatically resizing an NSWindow based on window contents
  • Previous by thread: How to receive events fro NSColorWell
  • Next by thread: RE: How to receive events fro NSColorWell
  • Index(es):
    • Date
    • Thread