10-02-2013 10:50 AM
I need to make different controls on my front panel appear and disapper with depending on what is being done is there an easy way to make a lot of different things appear and disappear without creating a property node for each individual one. Its slowing me down a bit during execution and its also making my primary VI huge.
Solved! Go to Solution.
10-02-2013 10:52 AM - edited 10-02-2013 10:59 AM
Try creating an array of references for the things you want to make visible/invisible, then pass that array into a for loop with a property node inside. This should save you plenty of block diagram space.
like so:
10-02-2013 11:27 AM
@Phil_ wrote:
Try creating an array of references for the things you want to make visible/invisible, then pass that array into a for loop with a property node inside. This should save you plenty of block diagram space.
like so:
I learned that trick from cross. 🙂
10-02-2013 11:29 AM
10-02-2013 11:37 AM
Or, if you have set conditions for which different combinations of things are made in/visible, you could use an enum for your conditions and choose the individual actions for each in a case statement. In the example below, I was switching between "Enabled" and "Disabled and Grayed Out" states to let the user know which controls s/he could adjust in the area of the program s/he was currently. I apologize in advance for using a picture, but the VI I'm taking it from (the instrument configuration panel) would be a real pain to disassemble enough to give code (there are 40 or so controls that I'm manipulating). The other "Modes" have different combinations of enabled/disabled conrols.
It can get big, but you're just talking about a single column. If there are significant groups of objects which always are switched together (I wasn't that lucky), then you can also bundle them to make the column shorter, as Phil_ said.
Cameron
10-02-2013 12:09 PM - edited 10-02-2013 12:10 PM
@Phil_ wrote:
If you are dealing with more than just a few controls/indicators, I would recommend setting Defer Front Panel Updates before the FOR loop and clear it after.
10-02-2013 12:29 PM
Another bit of advice is that if you have a set group of controls/indicators which are grouped together on the front panel, and will always be visible/hiddent as a group, place them in a cluster and simply make the cluster visible/hidden. This of course only applies to this unique situation. The other responses are useful for more general applications.
you can also make the cluster invisible to the user by making it's borders transparent.
10-02-2013 01:10 PM
If you are dealing with more than just a few controls/indicators, I would recommend setting Defer Front Panel Updates before the FOR loop and clear it after.
Please forgive my ignorance, but what is the advantage of doing this?
10-02-2013 01:12 PM
Every time you change the property of a control, the processor takes time to update the front panel. So if you were to hide 50 controls, it would update the front panel 50 times. This can be time consuming and slow down your code. Defering the update until the end saves processing time.
10-02-2013 02:34 PM - edited 10-02-2013 02:35 PM
Wow I am really impressed with the amount of feedback I got for this question. Ultimitly I am going to go with creating clusters and the for loop both of which were suggested above; since when all is said and done I have about 10 clusters that I need to make appear and disappear. Thanks for all the help Kudos all around lol.