Debugging color problem(s)

Discussion in 'Mac Programming' started by Dreamspinner, Jan 16, 2013.

  1. macrumors member

    Joined:
    Dec 17, 2012
    #1
    OS X 10.8.2, XCode 4.5.2.

    I put a round button on my view and set it borderless and used it to simulate an LED. I set the color thus. Worked well.
    Code:
    [[buttonLED3 cell] setBackgroundColor:[NSColor redColor]];
    [[buttonLED3 cell] setBackgroundColor:[NSColor greenColor]];
    
    Then I colored the background like this:
    Code:
    NSColor *myColor = [NSColor colorWithCalibratedRed:(189/255.0f) green:(219/255.0f) blue:(201/255.0f) alpha:(1.0)];
    [myColor set];
    [myWindow setBackgroundColor:myColor];
    
    Next I colored the other buttons using core animation/content filters.

    Somewhere along the way the LEDS quit, they show no color.

    I went back and removed all the window coloring and the core animation settings and did a clean. I even added another simulated LED, but still no color.

    Two questions. How can I debug the loss of ability to color the LEDS?

    Is there a conflict between any of the steps I took that would prevent me from doing all the coloring?
     
  2. macrumors 603

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #2
    The line

    Code:
    [myColor set];
    Seems out of place. Maybe try removing it and see what happens?
     
  3. ytk
    macrumors regular

    Joined:
    Jul 8, 2010
    #3
    This is a long shot, but sometimes it seems like UI elements don't always realize they need display updating correctly (or rather, when you might think they should). You might try calling setNeedsDisplay:YES on anything that doesn't look like you expect it to. If that doesn't work, try just issuing a straight-up display to the object (e.g., [[buttonLED3 cell] display]).
     
  4. thread starter macrumors member

    Joined:
    Dec 17, 2012
    #4
    That's part of coloring the background, not the LED. Removing it had no effect on either.

    ----------

    Good thought, but no joy. I can sorta understand the one that was there getting unhooked by the other changes, but not the newly added one.
     
  5. macrumors 603

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #5
    Are your outlets set properly?

    It seems like you might want to just zip your project and post it to these forums so someone else can take a look at it... I don't think we can help you with just the snippets and description you've given so far...
     
  6. thread starter macrumors member

    Joined:
    Dec 17, 2012
    #6
    Good thought. I had already reset the outlet for the first one, and set the outlet for the new one. Now I tried adding a level indicator and changing the level on that, and ..... HUH?.... the 2nd LED button started working.
    Removed the progress bar and the button still works. I also removed the 1st button. All this before I read this post, so I don''t think attaching the project would be of any benefit, but I will if you think it would.

    So, problem gone. Not understood, just gone.:rolleyes:
     
  7. ytk
    macrumors regular

    Joined:
    Jul 8, 2010
    #7
    Well, sometimes your outlets get stopped up with extra bits and junk, and you need to clear that out for them to work properly. The solution is to create an NSOutletPlunger and call [plunger unclogOutletsForObject:]. :p
     

Share This Page