From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reusable Code

I am writing a program in which I need a lot of buttons to appear and dissappear at certain times. Namely, I need about 80 to 100 items to become invisible every time one of about 20 buttons on my front panel is pressed. I'd prefer to find a way to do this without having to make 20 copies of the 80 to 100 property nodes that its already going to require to make the program. So is there a way I can use variables or something else to allow me to reuse the code that will make the items all non visible?
0 Kudos
Message 1 of 6
(2,476 Views)
I'd still use property nodes, but look at the attached image. It uses property nodes to get a reference to the front panel, then a reference to all the controls and indicators. From there, you can get the label and find the controls you want to turn on or off. You would just need to create an array of the controls you are looking for.

Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 2 of 6
(2,476 Views)
Since LV 6.0, you can create a control reference for a particular control/indicator whereby that reference can be passed as an input to subVIs so that control/indicators properties in your main VI is accessible in a subVI. This saves a lot of property node re-creation! You may want to search the LV docs for control references for more info.

Robert
0 Kudos
Message 3 of 6
(2,476 Views)
how about using the subpanel feature?
create 20 subpanel vis for your setups an splash them on your screen?
Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 4 of 6
(2,476 Views)
And yet another idea....

Use a tab control or a set of tab controls.

You can drive a single tab control with 20 tabs for 20 views,
or
use 20 single page tab controls.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 6
(2,476 Views)
Err.. alright, but how do I get all of the property nodes into a subvi?
0 Kudos
Message 6 of 6
(2,476 Views)