LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to prevent a terminated Sub-Panel VI from blocking the rest of the application?

Hello,

 

I have a little test VI with that launches 2 sub VIs inside a sub panel.

maflAT_1-1639919644878.png

This works perfectly fine, with each VI receiving GUI events independently of each other.

 

What I'm unsure about is the optimal way to handle the termination of a sub VI.

 

Without any further action, a terminated sub VI will stay visible inside the panel with no indication to the user, that it is no longer running. At this point, the rest of the application is still running fine.

But as soon as you click a button in the terminated sub VI, the other sub VI and the top level VI will become unresponsive.

 

My current solution is to poll execution state and remove the sub VI from the panel if the state changes from "Run top level" to "running".

I'm not happy with this solution for the following reasons:

  • This does not work when launching sub VIs via start asynchronous call. It seems like asynchronously running VIs are always in execution state "running".
  • In some situations I might prefer to keep the sub VI visible and just block it from receiving inputs.
  • I have to poll execution state.

Other things, that I tried:

  • Calling "Front Panel.Close" from the sub VIs exit code and from the top level VI.
    -> This seems to have no effect. I guess the FP is technically already closed.
  • Calling "Abort VI" from the sub VIs exit code and from the top level VI.
    -> Raises error 1000.

 

How do you guys handle this situation?

 

Is there a clean way to handle this without setting up some explicit communication between the top level and sub VIs?

 

My perfect solution would be if I could just call "Front Panel.Close" or something equivalent to "Ignore GUI events" in the sub VIs exit code.

 

test panels.png

counter.png

Download All
0 Kudos
Message 1 of 6
(1,269 Views)

How do you guys handle this situation?


I use a queue, notifier or dynamic event.

Is there a clean way to handle this without setting up some explicit communication between the top level and sub VIs?


No.  You can try some of the things you already tried but, those aren't really "clean." 😉

 

Why are you trying to avoid some state information exchange between the subpanel parent and child? They are related by dispatch.  Think of it like making a phone call to your mother to let her know how you are doing.  EVEN more importantly,  mom is going to find out anyway so, it's best to hear it from you first. (It saves her a lot of aggravation trying to figure out what you are up to now)


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 6
(1,260 Views)

Why are you trying to avoid some state information exchange between the subpanel parent and child? They are related by dispatch.  Think of it like making a phone call to your mother to let her know how you are doing.  EVEN more importantly,  mom is going to find out anyway so, it's best to hear it from you first. (It saves her a lot of aggravation trying to figure out what you are up to now)

That's an interesting way of looking at it 😆.

I was just wondering if I was missing some obvious procedure. Not trying to avoid information exchange.

0 Kudos
Message 3 of 6
(1,230 Views)

Don't forget any pertainate termination state data.

 

Pass/fail. error, user abort, et cetera.


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 6
(1,223 Views)

I haven't used SubPanels much, but i'd use a User Event to send information 'upwards' that it's closing. Main VI can then remove it accordingly. Maybe you can send 'ThisVI' as data and use it as a general Close Panel function.

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 6
(1,203 Views)

@Yamaeda wrote:

I haven't used SubPanels much, but i'd use a User Event to send information 'upwards' that it's closing. Main VI can then remove it accordingly. Maybe you can send 'ThisVI' as data and use it as a general Close Panel function.


Thank's for the tip. I like this idea.👍

0 Kudos
Message 6 of 6
(1,176 Views)