LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

can table contain different text colors?

I have a table of strings (from the List, Table, and Tree pallete) in my VI.  For my initial testing, I hardcoded two string controls (one red, one blue), and then used the Set Cell Value method to write the string to the table.  It wrote the data, but in the table the text was all black.  I tried a similar approach using the ItemNames property of a multi column list box, but had the same result.

 

Is there a way to have different colored strings within the same table?

table_color.png

0 Kudos
Message 1 of 4
(2,450 Views)

Yes, a table can show strings in different colors.

But: you have to set those colors in the table too! There are properties for cells, among them you will find colors…

 

Your approach will not work as you only copy the value of the strings into the table, but you don't copy the string's properties (like color, alignment, font, etc.)!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(2,444 Views)

ah - of course!!  thank you, I've already applied the fix.

 

One other question - can a string contain mixed colors?  For instance, what I'm trying to do is display a memory inside a table, and when the value in a memory changes, it would be nice if I could highlight only the nibble that changed.

 

So if the value changed from FFED to FFAD, then only the A would be red...

 

I tried to implement this first of all by simply changing the color of two string controls, then concatenating them, but of course this doesn't work (resulting text was black)...right now I have no good ideas other than changing the color character by character, but still - once I combine them into a single string, it will go all black.

0 Kudos
Message 3 of 4
(2,439 Views)

Hi,

 

yes, a string (indicator) can show text in different colors too. You will have to use the Text.Selection property before applying colors to the selcted text…

(As far as I remember there are also example VIs coming with LabVIEW explaining how to do this!)

 

In a table this looks different: Here I can't find any Text.Selection property at a quick glance…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 4
(2,435 Views)