LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set [4] colors of all boolean indicators from a subvi

Hello,

 

I'm trying to figure out how to set [4] colors of all boolean indicators from a subvi.

 

Problem:
Developing LV code for variety of sequential testers that have many boolean indicators (LED's) for Pass/Fail results.  Some indicators are in clusters and some are in arrays of clusters, but most are individual - the total number varies from project to project.

We want the LED colors (True & False) to be different at the start, than during the test (specifically once the given test point is complete).

 

I want to do this with a subvi and have figured out how to change individual indicators, but I can't figure out how to change all indicators on a given VI (for initialization).

I know part of my issue is related to type-def vs. strict type-def and I haven't figured out how to determine which controls and indicators are bool (strict) type, when looping through an array of all controls for a given VI.

 

Any help or insight would be greatly appreciated!

 

BR;

Shaun

BR;
Shaun
0 Kudos
Message 1 of 12
(5,504 Views)

If you want to change the colour of a 'Boolean' indicator, then a subVI with a Boolean input (to determine the state) and a colour box if often much better.

You can't set the colours of a strict type def control/indicator - but you could change the colours of a colour box which looked like it.

 

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 2 of 12
(5,500 Views)

I recently did just what you described.  I presume you know that you need to pass a reference to your Boolean Indicator into your sub-VI.  In my case, I wanted the ability to turn the indicator On or Off, to Show or Hide it (Visible property), and to change the basic On/Off color from the set Red, Green, Blue, and Yellow (I used an e-num).  For the latter, I had a sub-VI that I passed in a Color Box of the appropriate On color, internally created another U32 for the Off color by dividing the RGB values by 2, then I set the four Boolean Colors as Off, On, Off, On (I didn't need a different color when being Pressed, but you could also simply feed in the 4 colors that you wanted to use).

 

Bob Schor

0 Kudos
Message 3 of 12
(5,459 Views)

Hi James_W,

 

I have a sub-VI that does as you describe (see attached).  I want to avoid (manually) creating all of the individual references, because a given front panel could have 70+ boolean indicators. I'm looking for a solution that would take the VI reference as an input and determine which (front panel) objects are boolean indicators and only change their colours.

 

Doing all indicators at one time would really be for a default or initialization case, so I don't necessarily need a boolean input to define the state (minor detail).  I plan to change individual indicator colours after each given test case (visual effect for the user to follow the test flow).  

 

Set Boolean Indicator Colors_Code.png

BR;
Shaun
0 Kudos
Message 4 of 12
(5,418 Views)

See if this helps...Do note that it will not check controls that are inside of tabs.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 12
(5,411 Views)

Hi Bob,

Thank you for your feedback. 

 

Do you know how to determine which controls / indicators on a given front panel are boolean indicators?  That's the part I'm struggling with.

I want to make a sub-VI that can be used for any given UI (front panel). 

 

Shaun

BR;
Shaun
0 Kudos
Message 6 of 12
(5,408 Views)

Perhaps you could use something like this instead.

"If you weren't supposed to push it, it wouldn't be a button."
Message 7 of 12
(5,389 Views)

hi SLD,

Bob showed you a way .. by finding all controls(/indicators) that are able to be cast to Boolean.

I extended his example to only return the indicators.

 

get-all-indicators.png


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 8 of 12
(5,381 Views)

Thanks code Paul, but we're still on LV2015 and so I couldn't open it.

 

Shaun

BR;
Shaun
0 Kudos
Message 9 of 12
(5,359 Views)

Thank you jwscs and Bob.  Your code gets me 80% of the way there!  

Now I just need to figure out how to deal with combinations of arrays, clusters, and tab controls. 

 

Really appreciate the help!

Shaun

BR;
Shaun
0 Kudos
Message 10 of 12
(5,357 Views)