01-31-2020 06:44 AM
I have a bit of a quandary and I'm looking for some advice, or if possible - best practice on what I've attempted to achieve here.
This does work - but I'm not happy with how untidy it is. I have a set of controls and indicators that I want to hide and unhide during the State Machine.
My solution was to create a SubVI that would loop through an array of control/indicator References and hide/unhide as per the Boolean input. My issue is that I now have that many to hide/unhide, it's become on huge pile of References being fed into an array.
Is there any better way to achieve this? Sometimes I overlook the simple and end up at the most complicated solution!
Solved! Go to Solution.
01-31-2020 06:50 AM
01-31-2020 07:09 AM
Thanks for the suggestions, I will investigate both and see which is the best for what I'm trying to achieve.
01-31-2020 07:16 AM
01-31-2020 09:31 AM
If all of the controls/indicators are together on the front panel, you could put them on a tab control. One tab would have the controls and a second tab without them. Then, hide the tabs themselves (so your user can't get to the wrong one) and when you change tabs programmatically, the controls will be visible or hidden - then there is only one thing to update.
01-31-2020 09:46 AM
If we're on alternative problems, and your setup has various groups of controls of which only one needs to be visible at a time, you could consider calling VIs by reference, wiring an Event reference or queue to them, and then embedding them in a subpanel and changing the VI that the subpanel contains with changing states in your state machine.
Not sure that describes your application at all, but perhaps it could...
01-31-2020 10:33 AM
That is a LOT of controls to be hiding and unhiding. I'd think either a tab control or subpanels would be a better solution. With the tab control you can even hide the tabs and control which set of controls/indicators are visible programmatically.
Another option that I really like is to bundle all of the references for all of the controls you want to show or hide into a shift register, along with your other "local" data (like settings, VISA references, whatever). Have a subVI that you can call with a "mode" selector, like "Idle", "Testing", "Test error", etc. Within the subVI, unbundle the references and wire them to FOR loops for which ones you want to enable/disable & gray/turn invisible/etc.
This is much more expandable than creating new references each time.
02-03-2020 06:06 AM
Every time I return to a project I'm working on I end up finding new functions I haven't explored yet and realise they are a perfect solution to the problem I have.
I've accepted the solution of Tabs as this works perfectly for the scenario I'm in, essentially a panel showing controls only required at the point of data capture. I do have a several controls which need to be hidden/unhidden on that tab but much more manageable that my original method.
Many thanks everyone to the suggestions - I have also looked into Sub Panels which I've not yet used, I just felt Tabs were the easiest solution to my problem.