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: 

How to change an array element color?

Hi everyone,

 

I'm trying to acheive something I tough would be easy... seems its not.

 

I have a 1D array inside a While loop. I want the n-element of the array be highlighted with the corresponding n-iteration of the loop.

 

I mean:

 

First loop cycle - First element of the array is highlighted (ex: yellow)

Second loop cycle - Second element of the array is highlighted (first element come back to normal)

... and so on...

 

Anyone has ever suceed? Can't find any answer anywhere.

 

Thank a lot

 

Eric

0 Kudos
Message 1 of 5
(11,149 Views)

Hi Eric,

 

I don't think it is possible to change the background color of a element inside an array.

 

Once I did a similiar thing, but with a For loop. I overlaped the array I wanted with an LED array (you can choose a square LED and set it to the size you want), and I set the specific LED element to TRUE for each i in the loop.

 

Mariana

0 Kudos
Message 2 of 5
(11,145 Views)

You can't.  Each element in the array must have the same properties.  Only the value can be different.

 

A couple of ways around that would be to to an array of clusters that contain the numeric (or string??) element.  Then you could get the cluster as an element, then change the background of the string or numeric element inside of that cluster.

 

You could also set your background for all of your array elements to be transparent.  Then underneath that have an array of color boxes.  Then you can change the colors of the color boxes as needed.

Message 3 of 5
(11,142 Views)

Am not sure with the array but you can do that with a list box control.

 

List Box color Example.png

 

Good luck

-----

The best solution is the one you find it by yourself
Message 4 of 5
(11,137 Views)

The way that we do this is to make a cluster with one number and a color box or something that you can change the color of. Place the number in front of the color box and make the background transparent. When you have entered in the values for the array (now a cluster) you can change the color box for the cluster to the color you need. It looks the same as an array but you get the control for the individual array elements.

Tim
GHSP
Message 5 of 5
(11,127 Views)