06-21-2017 07:51 AM
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
06-21-2017 07:57 AM
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.
06-22-2017 11:47 AM
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
07-05-2017 06:27 AM - edited 07-05-2017 06:29 AM
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).
07-05-2017 06:37 AM - edited 07-05-2017 06:38 AM
See if this helps...Do note that it will not check controls that are inside of tabs.
07-05-2017 06:38 AM
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
07-05-2017 08:56 AM
Perhaps you could use something like this instead.
07-05-2017 09:13 AM
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.
07-06-2017 05:55 AM
Thanks code Paul, but we're still on LV2015 and so I couldn't open it.
Shaun
07-06-2017 05:59 AM
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