Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Dreamspinner

macrumors member
Original poster
Dec 17, 2012
39
0
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?
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
9,560
6,059
The line

Code:
[myColor set];

Seems out of place. Maybe try removing it and see what happens?
 

ytk

macrumors 6502
Jul 8, 2010
252
5
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]).
 

Dreamspinner

macrumors member
Original poster
Dec 17, 2012
39
0
The line

Code:
[myColor set];

Seems out of place. Maybe try removing it and see what happens?

That's part of coloring the background, not the LED. Removing it had no effect on either.

----------

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]).

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.
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
9,560
6,059
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...
 

Dreamspinner

macrumors member
Original poster
Dec 17, 2012
39
0
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...

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:
 

ytk

macrumors 6502
Jul 8, 2010
252
5
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
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.