From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Main VI stops fucntioning after i open and close a subvi from an event structrue.

Solved!
Go to solution

Hi,

 

I am trying to open a pop up vi from an event. I have been struggling with this for a while now. When i open a pop up vi and close it, the main vi stops running properly.

 

I have narrowed it down to the fact that the event which calls the subvi never finishes when the subvi is closed.

 

The attached image is an example of what I am currently doing. When I run this, i never see the dialog box that says 'here'

 

 

maybe useful as a hint to the problem...

This does work properly if I run the vi, click to open the subvi, close the subvi, (here the main vi is not working properly, cant click anything)  then stop the main vi, run the main vi again, open and close the subvi, and then i see the 'here' dialog, and my main vi functions properly.

 

thanks

 

J

 

 Event PopUp Example.png

0 Kudos
Message 1 of 5
(2,925 Views)
You've made the subVI way too complicated. Go to the window appearance properties and simply set it to show front panel when called and close afterward. No need at all for the fp.close and the local variable. The ok button terminal should be inside the event and you just wire that to the loop termination terminal. Get rid of stop2 entirely.

Have you taken any of the free tutorials or classes?
0 Kudos
Message 2 of 5
(2,914 Views)
Solution
Accepted by topic author JJMenen

What is actually happening is you hit the Ok button and your panel closes and you set the Stop 2 to True.  Ok, that is fine except for the fact that the Stop 2 terminal has already been read during that iteration of the loop.  So the loop will go again.  This time is has read the Stop 2 at a TRUE, but the event structure needs an event before the loop can complete.  But the front panel has been closed already and you are stuck.

 

As Dennis said, get rid of the Stop 2 and just wire the TRUE constant straight out of the event case.  Wire a FALSE for all of the other event cases.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 5
(2,900 Views)

Thank you for the reply. The method you have mentioned led me to needing to use the fp.close.

 

If i stop the vi using an event, the vi still runs and never closes. Here is what i have tried.

 

WindowAppearance.png

0 Kudos
Message 4 of 5
(2,895 Views)

crossrulz,

 

Thanks for your help, that makes sense and it works now.

0 Kudos
Message 5 of 5
(2,885 Views)