LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

change text color in string indicator

Solved!
Go to solution

Hello,

 

I want to change the text color of a certain word (example: Passed or Failed) in a string indicator during runtime.  Below is the sample code I created but it didn't work as I wanted.

 

The result should be :

 

This is line....Passed

This is line....Failed

 

Can anybody show me what I did wrong?

 

Thanks in advance,

 

sample code.png

0 Kudos
Message 1 of 4
(3,088 Views)

Writing to the string clears the formatting. Since you re-write to the string control each loop, each time you loop it clears the previous formatting information. If you set the iterations terminal to 1, "Passed" turns green. Stepping through the code shows that it turns green after the first loop, then when you write to it a second time (to add the second line) it resets to black.

 

The formatting is part of the string control's data, not part of the shift register's data, and the string control doesn't retain the formatting data. You will have to update all of the lines each time you write to it.

 

https://forums.ni.com/t5/LabVIEW/Dynamically-change-substring-text-color/m-p/3111383/highlight/true#...

Message 2 of 4
(3,057 Views)
Solution
Accepted by pvoh

It seems that color properties are cleared if the string is updated, so you would need to rewrite all selective properties. This can get expensive if the string gets large.

 

altenbach_0-1628783205344.png

 

 

 

I am not sure why you have this gigantic case structure if their cases only differ by a single color constant. All that belongs inside the case is what differs, the rest belongs after the case. I am also not sure why you need to reset it to default if you could just write the desired value with the property node you already have.

Message 3 of 4
(3,053 Views)

Thanks for your help guys.!

0 Kudos
Message 4 of 4
(3,046 Views)