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
(1,300 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
(1,285 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

Owner, Q Software Innovations, LLC (QSI) | Director, GCentral | Admin, LabVIEW Wiki
Tech Lead, Hill AFB LabVIEW Center of Excellence | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner


Message 3 of 7
(1,267 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
(1,252 Views)

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

 

Bob Schor

0 Kudos
Message 5 of 7
(1,224 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
(1,203 Views)
Solution
Accepted by topic author KaareBach
Awesome! Glad I could help.
Quentin "Q" Alldredge

Owner, Q Software Innovations, LLC (QSI) | Director, GCentral | Admin, LabVIEW Wiki
Tech Lead, Hill AFB LabVIEW Center of Excellence | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner


0 Kudos
Message 7 of 7
(1,195 Views)