08-12-2021 08:26 AM - edited 08-12-2021 08:32 AM
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,
Solved! Go to Solution.
08-12-2021 10:42 AM
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.
08-12-2021 10:48 AM
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.
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.
08-12-2021 10:58 AM
Thanks for your help guys.!