can't get it to work!

Discussion in 'Mac Programming' started by Darkroom, Oct 31, 2007.

  1. Guest

    Darkroom

    Joined:
    Dec 15, 2006
    Location:
    Montréal, Canada
    #1
    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...
     
  2. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    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
    Code:
    [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
    Code:
    [myWhiteSelection changeWhite:nil];
     
  3. thread starter Guest

    Darkroom

    Joined:
    Dec 15, 2006
    Location:
    Montréal, Canada
    #3
    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
     
  4. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #4
    Simply add it to windowColor.h like so:

    Code:
    #import <Cocoa/Cocoa.h>
    
    @interface windowColor : NSView {
    	NSColor	*fillColor;
    }
    
    [b]- (IBAction)changeWhite:(id)sender;[/b]
    
    @end
     
  5. thread starter Guest

    Darkroom

    Joined:
    Dec 15, 2006
    Location:
    Montréal, Canada
    #5
    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?
     

Share This Page