LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I remove a running subpanel VI?

Solved!
Go to solution

I have seen examples of inserting VIs into a subpanel, but when inserting a new VI, the code always removes the current VI and aborts it.

 

Is there a way to "swap out" a VI for another but keep it running in the background?

0 Kudos
Message 1 of 8
(4,625 Views)

Removing a VI from a subpanel (either by using the Remove VI method or by inserting another VI) should not cause the VI to abort. The two are unrelated. Are you sure you're not stopping or aborting the VI using another method? Can you create a simple example showing the problem?


___________________
Try to take over the world!
0 Kudos
Message 2 of 8
(4,619 Views)

When you insert a sub vi into your sub panel generally it won't run you have to invoke a run method to run that vi and the same way it won't abort the vi. But generally we use to stop the vi using the set control value method because when you try to insert the same vi again it will give you an error. The sub panel will only insert a vi which is not running.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 3 of 8
(4,611 Views)

P@Anand wrote:

When you insert a sub vi into your sub panel generally it won't run you have to invoke a run method to run that vi and the same way it won't abort the vi. But generally we use to stop the vi using the set control value method because when you try to insert the same vi again it will give you an error. The sub panel will only insert a vi which is not running.


I'm getting the "VI in the wrong state" error when I try to swap two VIs back and forth. It only works the first time the VI is inserted into the subpanel (unless it's stopped). I was hoping I could swap VIs in and out of the subpanel while they continue to run. I have a bunch of clone VIs that the user wants to display. I wanted a method of keeping the screen size down to something reasonable.

0 Kudos
Message 4 of 8
(4,602 Views)

So you can check the state of the vi before inserting it into the sub panel that should solve your issue. When you want to insert a clone instanse use the option in the open vi reference as 0x08 (see detailed help of open vi reference) so when you open it again it won't give you error since you will open the next clone instance.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 5 of 8
(4,597 Views)
Solution
Accepted by topic author BillMe

It really does work and here's a quick example (2009). Changing the numeric value creates a new VI or runs an existing one and you can see from the counter that the VIs keep running even when you switch.


___________________
Try to take over the world!
Message 6 of 8
(4,593 Views)

Looks like my main problem was not keeping the VI reference in memory as you're doing in your example using attributes.

 

Thanks tst, putting this in my "toolkit".

0 Kudos
Message 7 of 8
(4,557 Views)

Disregard my last post, my problem was not looking at the execution state of the VI before calling the Run method (noob mistake) and then inserting it into the sub-panel. If already running just insert it. Now I can swap VIs in and out while they continue to do "work" uninterrupted. Cool.

0 Kudos
Message 8 of 8
(4,541 Views)