I want to have a string control where text has different colors (like DockLight fx).
What I CAN do now, is writing a string with multipe lines to a string control.
Then format every line in a different color.
But then it fails, when I want to add a new text, with a new color.
When I update the string control, all former formatting is overwritten, and all lines has the same color.
I want to be able to:
Add string1 with blue color.
Add string2 with green color
Add string3 with red color
Is this possible?
Thanks in advance!
Solved! Go to Solution.
I believe attributes (font size, color, Bold/Italic, etc.) apply to the entire string. I suspect that if you have an Array of String, then every element of the Array (i.e. each String) also shares a common set of Attributes. So I do not think what you want to do is (easily) possible in LabVIEW.
The trick is to programatically select the word and then set the color.
This works for setting bold, italics, etc. But, when the value is updated the colors could be reset or not match up. You can loop though the string but defer panel updates until you are done to avoid slow draw rates.
The following posting may be helpful.
Hi, and thanks for the advice, to defer panel updates!
I think this is the way to do it. It is not smooth, but I believe I'm gonna make it work.
For now, I will make a solution where I simply stores an array/string of all incoming bytes.
I will also store the name of "who" has sent the byte, and later use this to format the color of each character.
When I want to update the string control/indicator, I will defer panel updates, loop through the two arrays, and allow panel updates again. I guess this willdo the trick. I have made some quick test, which show som glitches, but when I get things cleaned up, I hope I can remove them.
I will tell you when I have tried this out.