LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically change substring text color

Solved!
Go to solution

Hello ! 

 

I'm working on a simple serial terminal and I'd like to change the color of each line depending on if the message is sent or received. I have a string indicator in which I append all messages, sent or received. 

 

My problem is that when I change the color of a substring using a property node, all the text of my string indicator changes. Here's a small VI that shows my problem (my actual VI is a bit too big to be put here but the string part works the same. I concatenate, keep the indices and apply the property node) : Screen Shot 03-30-15 at 11.58 AM.PNG

 

Result : 

Screen Shot 03-30-15 at 11.59 AM.PNG

 

Any idea on how I could change the color only of the new line ? It looks like the selection doesn't really work, since everything in the string takes the new color. 

 

Thanks in advance,

 

Tim

 

PS : I saw a solution on the web in which the property node has to be extended for each line, obviously it doesn't work for me as the number of lines changes dynamically. 

0 Kudos
Message 1 of 4
(4,424 Views)

The text size, colour, etc. apply to the entire string control, not specific parts of the text.

 

(EDIT - I stand corrected - thx Jim)

 

A severe omission (in my opinion) is the lack of a Rich Text control or HTML control native to Labview that text formatting can be applied to. However, you could add an active X browser control and format your text with html.

0 Kudos
Message 2 of 4
(4,415 Views)
Solution
Accepted by Tikim

The problem you're going to have is that the string doesn't contain formatting information and the indicator doesn't retain it.  You'll have to set the font.color in every line, every time you get a new message.  See my post here - http://forums.ni.com/t5/LabVIEW/Different-fonts-in-string-indicator/m-p/1601602/highlight/true#M5823...

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 3 of 4
(4,414 Views)

Thanks Jim, I'll try that. It looks slow, too bad NI doesn't manage this better. Some HTML balises would be so efficient and easy to implement 😕

0 Kudos
Message 4 of 4
(4,405 Views)