PDA

View Full Version : can't get it to work!




Darkroom
Oct 31, 2007, 05:16 AM
hi there... if anyone feels like helping a total n00b please feel free... my source files are here: http://www.imagectrl.com/LightTest.zip

it's very small test app... i'm basically trying to enable the "Revert To White" item in the "Color" menu, but of course it isn't working... the "Revert To White" should immediately change the custom view to white...

any help would of course be appreciated...



kainjow
Oct 31, 2007, 08:31 AM
You've got the menu setup correctly to call your selectWhite: action. However, selectWhite: in turn is not doing anything.

In windowColor you need to declare changeWhite: public, so that your WhiteController method can see it. Also it needs the [self setNeedsDisplay:YES]; call just like changeColor: or else the view won't redraw. Lastly, you need to call your changeWhite: method in selectWhite: by using [myWhiteSelection changeWhite:nil];

Darkroom
Oct 31, 2007, 04:03 PM
great it works now... but i have a warning:

"warning: 'windowColor' may not respond to '-changeWhite:' (Messages without a matching method signature will be assumed to return 'id' and accept '...' as arguments.)

i think it's because i didn't declare it public, as you said?... i don't even know what that means :p let alone know how to make something public

kainjow
Oct 31, 2007, 04:11 PM
Simply add it to windowColor.h like so:

#import <Cocoa/Cocoa.h>

@interface windowColor : NSView {
NSColor *fillColor;
}

- (IBAction)changeWhite:(id)sender;

@end

Darkroom
Oct 31, 2007, 05:06 PM
sweet! thanks... it's so funny, my app idea would probably take you pros about 20 seconds to build... gotta love the cocoa learning curve...

should both the color controller and white controller be in the same controller object? like would that make the app run faster or something? or is it more appropriate to have them separate like i have them currently?