LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

stopping a VI when its FP is closed

Solved!
Go to solution

I am having an issue getting the interaction i want between two VI's i have made.  I have a top level VI that lets the user choose some options for different tests to run.  When they make the choice a subVI opens (and in the block diagram of the top level VI it shows the called subVI with the green arrow signalling that it is running).  The test works fine with the subVI and when the user is done I would like them to be able to close the window.  However if you use the X in the corner to close this FP, the top level VI block diagram still shows this subVI as running and gets stuck there.


Everythign works fine if you hit the stop button in the subVI, the top level VI will continue as it should.  That would be good enough for me, but i know that other users will try to close the window and i cant let it freeze up the top level VI every time.

 

I guess what i am really looking for here is to be able to close the window of this subVI, but have it stop execution first so that the top level VI doesnt get stuck.

 

I have tried using an event structure that will trigger TRUE to be sent to the stop button when the front panel is closed.  The subVI seemed to just sit there waiting for the front panel to be closed rather than doing any of the rest of its procedure.  I think this may be due to the fact that i am using a state machine, it just doesnt seem to go on to the next state.  When I looked at it with highlight execution on it seems to be stuck at the event now.

 

Any enlightenment you can give on this issue would be greatly appreciated

0 Kudos
Message 1 of 10
(5,848 Views)
Solution
Accepted by topic author YoMetric

You can set the subVI's properties so that its frontpanel is not closeable:

This way you force the user to hit the stop button.

 

To get control over the subVI regardless in which state it is,

you can call it dynamically: Open a VI reference to it and use a "Call By Reference" node:

Now you're able to stop it via invoke node from another loop but that's

something you should avoid if you can.

 

Message Edited by candidus on 07-01-2009 07:32 AM
0 Kudos
Message 2 of 10
(5,838 Views)

Or you could register for the FP event in the sub VI (or even main VI), and finish the code inside the VI.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 3 of 10
(5,830 Views)
Making the VI non-closeable seemed like the simplest option.  That should work fine for my situation.  Thanks a lot for the quick responses
0 Kudos
Message 4 of 10
(5,827 Views)

I absolutely hate having to press stop buttons.  So, I use the X button.  Make an event structure with the event Panel Close.  I wire a true out of this case into the stop terminal on the while loop.  Works wonderfully.

untitled.PNG

 

--
Tim Elsey
Certified LabVIEW Architect
Message 5 of 10
(5,805 Views)
I should also note that if you don't want the front panel to close you can use the Panel Close? event and wire a true to the discard terminal.
--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 6 of 10
(5,786 Views)

I have solved this problem in a different way (upper part). Remember to add a command that re-open the frontpanel when the vi is lunched (bottom part).

Cattura.JPG

Message 7 of 10
(5,178 Views)

@giancarlotamburello wrote:

I have solved this problem in a different way (upper part). Remember to add a command that re-open the frontpanel when the vi is lunched (bottom part).


You added to an 8 year old thread with a cryptic message. You probably want to explain to all of us in much more detail why you think this is a good solution. Your suggestion needs to constantly poll the front panel state with each iteration of the loop, which seems like a waste of resources.

0 Kudos
Message 8 of 10
(5,162 Views)

So what is wrong?

I have just used @giancarlotamburello's code.

So far it seems to work for me.

0 Kudos
Message 9 of 10
(4,012 Views)

@Станев wrote:

So what is wrong?

I have just used @giancarlotamburello's code.

So far it seems to work for me.


Read the post right above yours.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 10 of 10
(3,985 Views)