LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

update subvi using typedef

I want to add a new page to the front panel of my VI. Now each time I add something to my front panel, I also need to update the clusters in all the subvi's. I know that we can update the subvi's using typedef. But I dont have a clearcut idea how to use them. I am attaching the VI also.

0 Kudos
Message 1 of 4
(3,122 Views)

You did not include any of your subVIs.

 

If you make the data structure a typedef, AND use the same typedef in all the subVIs, it will get updated everywhere if you edit the typedef, e.g. to add new elements. Make the typedef a diagram constant and wire it to the top center of the bundle node. Name the elements with clear names in the typedef and change to "bundle by name" to avoid wiring errors and keep things readable.

 

You should really redesign your code from scratch. Once that bundle node gets even bigger, things are even less maintainable. Why do you need all these references??? This is not normal!

0 Kudos
Message 2 of 4
(3,121 Views)

Hello all!

 

Sorry that i pick this thread up from the dust, but it completely hits my point.

 

I also wanted to control the front panel of my main VI out of different subvis. NI itself suggests to pass a reference of the control to the subvi to do the job (link). So I did it. I then decided it might be easier to create a typedef of a cluster which contains references to ALL my front panel objects and pass this cluster to all my subvis. It works just fine, but like here my code contains an ugly spot where i save all references to this cluster. So I absolutely agree that it doesn't look normal to save all these references 🙂

 

Is there a more clean way?

 

Thanks!

0 Kudos
Message 3 of 4
(2,805 Views)
You could also pass into a subVI a reference to the VI itself. From that you can get a reference to the front panel, and from that an array of all the controls on the front panel.

You can then locate the ones you wish to manipulate using the label text property of each control reference.

There are also VI methods for accessing the values of controls and indicators by name.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 4
(2,767 Views)