advertisement

Article:
  Creating a Color Meter Using Cocoa
Subject:   Works great!
Date:   2001-06-19 22:43:24
From:   johnts
Response to: Works great!

Ok. I tried the extra credit too. But it's not working just right. It's close, though. What I did was add a new Action in the Controller called setAll: Then I wired up the color well to the setAll: action. Now, I had to go into the source files and manually add the action - I'm assuming that once you "Create Files...", then add something after, there's no way to just update the files?


Now, in my setAll: method, I grabbed the color from the colorwell


NSColor *theColor = [sender color];


Then I got the colors and put them into the variables:
blueValue = [color blueComponent];
etc.


Then I updated the controls:
[blueField setFloatValue:blueValue];
[blueSlider setFloatValue:blueValue];


It compiled and when I run it and click the color well to get the color picker, the numbers in the text fields change, but the sliders don't. What am I missing?? I'm close, and I'm slowly figuring out this Cocoa thing - all this Action/Outlet stuff is confusing!


Thanks!