LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SubVI locks up main VI

Solved!
Go to solution

I have a main VI with a front panel with several indicators.  I offloaded several indicators to a SubVI to make my main panel less busy.  I want to launch this SubVI when the user clicks on 'more' on my main VI.

 

To accomplish this, I created a new event and registered it to a mouse up event on the 'more' button.  Inside this event, I placed only my SubVI.  I right clicked and selected SubVI Node Setup, then checked the 'show front panel when called' and 'close afterwards if originally closed' checkboxes.

 

The SubVI launches as expected when I click on 'more'.  The problem is, once I close the subVI, my main VI is locked up.  I can't do anything at all.  There's nothing going on in the SubVI...no loops, no logic...right now it's just a collection of indicators.  If I click the 'abort execution' button in my Sub, then it also aborts my main.

 

My suspicion is that - as far as my main VI is concerned - my subVI never stops running.  How do I accomplish this?  There's no real user interaction in the sub...it's just indicators the user would look at and then close the sub VI window.  So I guess what I want to do is abort only the sub VI when the user clicks on the X in the sub VI window.

 

thanks in advance for the help.

0 Kudos
Message 1 of 27
(2,985 Views)

If the sub-vi has a loop and you close it with X it simply closes the front panel, it doesn't stop. The easy solution is to disable the X in window setting and stop it with an OK-button (it it's only showing some info).

/Y

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 27
(2,974 Views)

What is the window appearance you have set? Can you show us the code, will be easy to understand what is happening.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 3 of 27
(2,971 Views)

I made no changes to the default window appearance.  Here is that menu:

sub1.png

 

 

Here is the code of the sub VI...it doesn't really do anything right now, as I am working through the basics of the display.  I will indeed be adding a loop since the subVI pops data from a queue, but to eliminate variables from what could be causing my issue, I removed it:

sub1.png

 

I'm not sure how I would get rid of the X...I didn't see a 'window appearance' setting that did not include it by default.  Regardless - as you can see I'm not using any loops in my subVI right now, so I don't know why the main VI would still think it's running even after I click the X to close it.

0 Kudos
Message 4 of 27
(2,963 Views)

"Allow user to close window" removes the X

/Y

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 27
(2,960 Views)

OK, so you're suggesting:

1. disable the X

2. create an OK button that gets wired to the 'stop' of any loops

 

right?

 

That is fine and I understand it, but I'm not using any loops right now as you can see...so any thoughts on why my main VI is locked up after I click the X?

0 Kudos
Message 6 of 27
(2,957 Views)

@Yamaeda wrote:

"Allow user to close window" removes the X

/Y


No it keeps the X ON.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 7 of 27
(2,944 Views)

Remove the Event in the Sub VI. Since you are closing the window (X) your event structure inside the code will wait until it gets the proper event and your main VI cannot trigger since it is alread locked inside an event. That is why you front panel gets locked when you click on your main VI.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 8 of 27
(2,942 Views)
Solution
Accepted by topic author bmishoe

I can't see exactly what is in your subVI from the image.  But I do see a Queue and an Event Structure.  Either of those situations could cause a "wait infinately" situation.  The Event Structure is the likely culprit here though.  I actually like to handle the Front Panel Close event if you already have the event structure.


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 9 of 27
(2,939 Views)

ok so it sounds like I shot myself in the foot by stripping out my subVI code in order to debug this problem.

 

So allow me to take a step back...or forward.  Whatever it is...

 

Ultimately I need an event structure in my SubVI, I know this for sure.  So it will be surrounded by a while loop, which means I need something wired to the 'stop' control of the loop.

 

So considering all our disccusion up to this point - what's the best way to handle it?  Like you said, if I already have the event structure, I might as well handle a front panel close event.  With that said - what do I 'do' in the front panel close event, and what do I wire to the 'stop' control of the while loop surrounding the event?

 

thanks guys for all the help

0 Kudos
Message 10 of 27
(2,933 Views)