06-30-2014 07:08 AM
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.
Solved! Go to Solution.
06-30-2014 07:18 AM
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
06-30-2014 07:21 AM
What is the window appearance you have set? Can you show us the code, will be easy to understand what is happening.
06-30-2014 07:31 AM
I made no changes to the default window appearance. Here is that menu:
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:
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.
06-30-2014 07:36 AM
"Allow user to close window" removes the X
/Y
06-30-2014 07:39 AM
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?
06-30-2014 07:48 AM
@Yamaeda wrote:
"Allow user to close window" removes the X
/Y
No it keeps the X ON.
06-30-2014 07:50 AM
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.
06-30-2014 07:53 AM
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.
06-30-2014 07:57 AM
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