09-15-2016 06:57 PM
Hi
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
etc.
Is this possible?
Thanks in advance!
Solved! Go to Solution.
09-15-2016 07:36 PM
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.
Bob Schor
09-15-2016 10:27 PM - edited 09-15-2016 10:28 PM
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.
Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner
09-16-2016 12:36 AM
The following posting may be helpful.
Changing colour of specific sets for words in text indicator
steve
09-16-2016 09:53 AM
Wow! Thanks, I didn't know that trick!
Bob Schor
09-16-2016 04:11 PM
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.
br
Kåre
09-16-2016 06:22 PM
Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner