LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing array element properties?

Hi,
 
I am using LV 7.1 and I'm trying to change the properties of individual array elements (text color & text bkgnd color).  I don't think this can be done with arrays.  I have over 50 elements in my array so switching to a cluster would be a mess.  Basically what I am trying to do is create a FP that looks something like the Jeopardy screen.  When a screen control is selected, I want to perform an action(subvi) and then change the text color & bkgnd color of the control such as green with black text when Pass or red w/ white text for Fail.
 
I could use a boolean array setup, but I have 4 different color schemes (Pass, Fail, N/A, untested) and haven't been able to figure this out yet.
 
Thanks in advance for any suggestions.  I don't want to write 50+ event cases.
 
Tony.
0 Kudos
Message 1 of 8
(4,355 Views)
I don't think it is possible to change the properties of just one element in an array.  All the elements in an array share the same properties.  You must use another approach.  A cluster may be your only option.  Of course, 50 individual indicators is also an option.  Also, you could use a roving indicator, and use property nodes to have the indicator placed over the array element chosen.  What a mess that would be.  Good luck.
- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 8
(4,345 Views)

You are right : you can't modify the settings for the individual elements in an array.

What you should do is to use a table. Basically, it's a 2D string array, but you can modify the color of each cell separately. See the attached vi

Chilly Charly    (aka CC)
0 Kudos
Message 3 of 8
(4,344 Views)

Thanks for the fast responses.  You guys should get a raise.  I've been playing with a table and it looks like that is the easiest way.  If I were to use a cluster, is there a way to auto-index through cluster elements just using a for loop?  I thought I once saw a way to get the item # of a control/indicator inside a cluster in a typedef.  Thanks Again.

 

Tony.

0 Kudos
Message 4 of 8
(4,340 Views)
Well, sort of...
 
What you can do is get an array of references to the components of a cluster.
 
Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 5 of 8
(4,324 Views)
I've done this sort of thing before. Create 50 indicators and then get a reference to each one. Then use a loop to move and size each indicator into position to make a nice matrix, using the property node. What you would be trying to code would be a type of TCL widget packer, if you knew how that worked.
0 Kudos
Message 6 of 8
(4,317 Views)
Here is a translation of Mike comments that illustrate a way to get the proper reference to a cluster element.
Chilly Charly    (aka CC)
0 Kudos
Message 7 of 8
(4,315 Views)
Hello Tony,

you may also use an array of color boxes (perhaps in background of your text). This way you can easily change the color: index the string array to change the text and use the same index to change the color. No need to use references or a hugh amount of seperate indicators. And you are free in color choices: you can use up to 2^24 colors!

Best regards,
GerdW


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