LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to reference a subVI in Application (c.f Development mode)?

Solved!
Go to solution
Highlighted

Am trying to create a pop up screen from my Main VI. So I need to reference to it using VI server from the Main and also close the SubVI when the user choses to close it.

 

In development mode I can use: current VI's path for the subVI or I can use current VI's path for the main and then build/strip path to get the subvi or I can use Application Directory.

 

Question is how will this be done when the application is built--- as in the application the path of the subvi does not exist anymore? Is it automatically located?

0 Kudos
Message 1 of 7
(373 Views)
Highlighted

hello,

 

the exe will start the main vi as startup vi. if you had mentioned in startup vi while building.

Depends on how you build exe

 

Bharath

Thanks & Regards,
Bharath Kumar
GCentral
0 Kudos
Message 2 of 7
(357 Views)

Hi rajiv,

 

In development mode I can use: current VI's path for the subVI or I can use current VI's path for the main and then build/strip path to get the subvi or I can use Application Directory.

You can also use a static VI reference…

 

Question is how will this be done when the application is built--- as in the application the path of the subvi does not exist anymore? Is it automatically located?

The path of the subVI typically stays the same inside the executable (since LV8 or so)…

Best regards,
GerdW
CLAD expired, using LV2011SP1 + LV2017 (+LV2019 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

Message 3 of 7
(345 Views)
Highlighted

@GerdW wrote:

...

You can also use a static VI reference

...

 

That is my preferred method unless dynamic instanciation is required.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 7
(337 Views)
Highlighted
Solution
Accepted by rajiv85

I do this using a sub-Panel in the Main VI.  When I want to run (and see the Front Panel of) a sub-VI, I use a Static VI Reference to the sub-VI and wire it to an Insert VI Method for the sub-Panel.  This not only starts the sub-VI running as a parallel asynchronous loop, it also provides access to controls and indicators on its Front Panel which act in the context of the sub-VI.

 

The same code works both in Development Mode and when built into an Executable (the Static VI Reference works wonders in this way).

 

Bob Schor

Message 5 of 7
(276 Views)
Highlighted

Piling it on...

 Another bonus of the static reference is that it includes the target VI in the hierarchy of the caller. This means no surprises when we try to invoke the VI and find out it was broken since it was not open and some code change broke it.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 7
(271 Views)
Highlighted

Thank you all for the responses!! Smiley HappySmiley Wink

0 Kudos
Message 7 of 7
(235 Views)