From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

Cell color in table

Solved!
Go to solution

Hi

I am making an alarm system with alarms continiously appearing in a table. These alarms are color coded, so i use the cellBGcolor property node to activate the cell colors. The problem is: I insert a row on top of the table for each iteration of an alarm. The text is pushed down a row, but the colors inserted in the last iteration do not follow... how can i solve this? I have som theories, but want to ask if there is a easy fix i havent thought about that may help me?

 

0 Kudos
Message 1 of 8
(4,144 Views)

image of the actual loop

0 Kudos
Message 2 of 8
(4,143 Views)

 

 


Magnhel90 wrote:The problem is: I insert a row on top of the table for each iteration of an alarm. The text is pushed down a row, but the colors inserted in the last iteration do not follow... how can i solve this?

I can't open your vi right now, please convert to 2015.

 

Regarding your screenshot: Have you tried a third sequence case for re-coloring?

 

0 Kudos
Message 3 of 8
(4,093 Views)

Can you open this one?

 

Have tried a third sequence, it still did not move the BGcolors

0 Kudos
Message 4 of 8
(4,087 Views)

Your code is doing exactly what you said it should do.  You said with every change of value on H or HH you set the row 0 column 0, 1, and 2 colors.  Then when the value changes again you change those colors again.  But when you insert a new row the colors don't get shifted down.  You need to color every row every time.  By the way an easier way to do this is by setting the column to -2 which sets the whole row active, then you only need to call the function once.

 

An alternative that is easier is to insert new events at the bottom, and auto scroll down.  Then you paint the newly inserted row color, and leave all the other rows alone.

0 Kudos
Message 5 of 8
(4,077 Views)
Solution
Accepted by topic author Magnhel90

Attached is an updated version which keeps track of the row colors that are added, then colors them all one at a time every iteration.  Like I said I prefer the other method of adding new rows at the end because you only have to color one new row each time instead of having to color all of them every time.

Message 6 of 8
(4,072 Views)

 


@Magnhel90 wrote:

Can you open this one?

yes,thanks

 

Have tried a third sequence, it still did not move the BGcolors

I see, as far as I know, that's the expected conduct of the table control.

 

You could use an 1d array of clusters, each cluster containing a color-box and a string ...


table-surrogate.png

0 Kudos
Message 7 of 8
(4,071 Views)

When you set the Active Cell using a property node, specify the row and column to make active.  After doing that the next call to set something like the Cell Color Background, will be applied to the cell you specified.  If the row is -2 it means all rows for that column.  If row and column are -2 then it means all cells.  Also in the future do searching on this issue (it has to be on the forums somewhere) and if nothing comes up make your own new thread asking the question.  This thread has been marked with a solution as the original problem has been solved.

0 Kudos
Message 8 of 8
(3,482 Views)