LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

ATTR_TEXT_COLOR not working on a string object

Solved!
Go to solution

I've seen posts but nothing directly for my issue. I have a string object on a uir panel and want to programmatically change the text color. I'm using SetCtrlAttribute with ATTR_TEXT_COLOR and giving it an RGB value (entered my own as 0x00RRGGBB, and even used MakeColor(x,y,z). No syntax or runtime errors, the text color just isn't changing.  Even tried ProcessDrawEvents() after the call to SetCtrlAttribute, and even ProcessSystemEventsI() to no avail. Help for the ATTR_TEXT_COLOR lists string objects as ones it works for. What gives?

0 Kudos
Message 1 of 8
(3,480 Views)

Could it be that the panel that hosts the string control has the "conform to system  colors" attribute set? 



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 8
(3,447 Views)

If Roberto's guess is not the issue, is your text control on a tab panel?

You can also check the return value of the SetCtrlAttribute function. If it is returning negative it is telling you why it is failing.

S. Eren BALCI
IMESTEK
0 Kudos
Message 3 of 8
(3,437 Views)

Thanks, Roberto. Good point, but no, it isn't checked

0 Kudos
Message 4 of 8
(3,430 Views)
Solution
Accepted by LelandDurrette

If neither my guess nor ebalci's theory is true, can you create a small example that exhibits this behaviour? This will make easier for us to discriminate the possible problems and suggest the best solution.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 5 of 8
(3,427 Views)

This is a good point as well. Embarrassed to admit it didn't come to mind. I tend to work with minimal code to begin with and return to add exception handling later, which I don't particularly like about my development.

 

Anyway, problem found: code in another area was stepping on the color change command, and resetting it.

 

Sorry guys, and I do appreciate your patience and understanding.

 

0 Kudos
Message 6 of 8
(3,425 Views)

It happens to me all the time! As far as projects grow up in complexity it always happens some weird code tangle that messes things up!

Anyway I'm happy you did find the problem. 



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 7 of 8
(3,415 Views)

Another possible oops: make sure the first parameter in the set control attribute is the panel handle, not the panel ID.

0 Kudos
Message 8 of 8
(2,341 Views)