From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Add characters to string control without complete update of control

Solved!
Go to solution

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!

0 Kudos
Message 1 of 7
(3,356 Views)

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

0 Kudos
Message 2 of 7
(3,341 Views)

The trick is to programatically select the word and then set the color.

 

Capture.PNG

 

Setting Color on Word.png

 

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.

Quentin "Q" Alldredge

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



Message 3 of 7
(3,323 Views)

The following posting may be helpful.

Changing colour of specific sets for words in text indicator

 

steve

--------------------------------------------------------------------------------------------------------------------------
Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
question. Give "Kudos" to replies that help.
--------------------------------------------------------------------------------------------------------------------------
0 Kudos
Message 4 of 7
(3,308 Views)

Wow!  Thanks, I didn't know that trick!

 

Bob Schor

0 Kudos
Message 5 of 7
(3,280 Views)

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

0 Kudos
Message 6 of 7
(3,259 Views)
Solution
Accepted by topic author KaareBach
Awesome! Glad I could help.
Quentin "Q" Alldredge

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



0 Kudos
Message 7 of 7
(3,251 Views)