LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SubVIs

Solved!
Go to solution
Highlighted

Hello Everyone,

 

I would like to know if the following is possible:

 

I have my main VI with an event structure which calls different SubVIs. Intern, each SubVI has its own event structure which is used to perform its own tasks (the front panel is enabled in modal so the user can only interact with this SubVI) . When the user is finished, the SubVI closes and the program returns to the main VI. Each SubVI has its own controls, shift registers, etc

 

Each time I want to create a new SubVI with an event structure, controls, shift registers I have to repeat it over and over manually and this is time consuming and monotonous. Is there a way to create a SubVI template and be able to use it multiple times? After creating a SubVI template, I can create an additional copy but this copy will have all the controls and SubVIs still pointing to the original template SubVI.

 

Example:

 

SUBVI A

    CONTROLS_1 A

    CONTROLS_2 A

     SUBVI_1 A

     SUBVI_2 A

 

If I copy SUBVI A, calling it SUBVI B, I will get the following:

 

SUBVI B

    CONTROLS_1 A

    CONTROLS_2 A

     SUBVI_1 A

     SUBVI_2 A

 

But I want the template to do this:

 

SUBVI B

    CONTROLS_1 B

    CONTROLS_2 B

     SUBVI_1 B

     SUBVI_2 B

 

And then I can use it over and over:

 

SUBVI C

    CONTROLS_1 C

    CONTROLS_2 C

     SUBVI_1 C

     SUBVI_2 C

 

I really hope my explanation is not garbage.

 

Thank you

 

 

0 Kudos
Message 1 of 2
(118 Views)
Highlighted
Solution
Accepted by topic author Acyr20

@Acyr20 wrote:

I really hope my explanation is not garbage.


It's not, but it's not possible the way you want it.

 

You can make a template (.vit), and when you open it it will create a new VI from it. But if you modify the template, the VIs created from it won't change.

 

As a programmer, you're looking for a way to facilitate code copies. You should be looking for a way to avoid duplicate code... At least you're looking for a way to update all the copies, but that is not possible in LabVIEW.

 

So, you should look for alternatives.

 

This is where it comes down to details... How similar are those GUIs? How different are they? What kind of events should they handle?

Message 2 of 2
(107 Views)