LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Launch VI from within the same VI (reentrant clone?)

I am trying to allow the user to launch another version of the top level VI if they select File->New from the top level user menu. I am having partial sucess with the code snippet that is attached. I have defined the top level VI as reentrant, and if a File->New event is detected, I open a reference to the current VI, get the file path, open a new reference in reentrant mode, load the front panel (via method), and run the VI (via method). The run Method is set to dispose of the reference and NOT to wait.

 

The main problem I am seeing is that there seems to be a dependecy between the VIs. If I try and stop the original VI, it does not seem to want to close since the cloned VI is running. If I stop the cloned VI, Labview seems to lock up. I am running version 8.20.

 

Thanks

0 Kudos
Message 1 of 6
(2,799 Views)

Hi tpascaru,

 

Have to tried making both of them to be non-reentrant and with normal priority (you can set it in VI Properties)? There is an example on calling VIs and closing them: http://forums.ni.com/t5/LabVIEW/How-can-I-call-a-VI-in-another-VI/td-p/281784 

 

Perhaps you could refer to the VIs posted in that forum link? 

 

Another possibility would be the event structure. Have you tried using event driven state machines?: http://www.youtube.com/watch?v=Qz1X1cyWjMA

 

Do you have the VI and the subVI for us to look into the issue?

 

Thank you

 

Warmest regards,

Lennard.C

Learning new things everyday...
0 Kudos
Message 2 of 6
(2,761 Views)

It might be so simple the reference is still alive, what happens if you Close ref after the vi-server call?

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 6
(2,733 Views)

Yamaeda: Thanks for the suggestion. I had originally tried closing the reference, and it would crash right away.

 

Lennard.C: I think the VI has to be reentrant since I am trying to spawn a new version of the the VI that is running. There are not 2 VIs, only 1.

0 Kudos
Message 4 of 6
(2,689 Views)

Hi tpascaru,

 

So meaning that you are calling the same subVI more than once and therefore you'll see the subVI's front panel opened twice without closing?

 

Warmest regards,

Lennard.C

Learning new things everyday...
0 Kudos
Message 5 of 6
(2,684 Views)

Correct -- if I understand what you are asking.

0 Kudos
Message 6 of 6
(2,646 Views)