07-01-2009 07:20 AM
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
Solved! Go to Solution.
07-01-2009 07:31 AM - edited 07-01-2009 07:32 AM
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.
07-01-2009 07:41 AM
Or you could register for the FP event in the sub VI (or even main VI), and finish the code inside the VI.
Ton
07-01-2009 07:43 AM
07-01-2009 08:52 AM
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.
07-01-2009 01:20 PM
04-05-2017 05:25 AM
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).
04-05-2017 09:27 AM
@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.
04-23-2020 03:04 AM
04-23-2020 01:33 PM
@Станев 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.