01-09-2019 07:24 AM
Hi everybody,
on my project I have created 2 different VIs, "MASTER" and "SLAVE".
When the VI MASTER is running by a push button present on the Front Panel I want to open the VI SLAVE and close the VI MASTER.
When the VI SLAVE is running by a push button present on the Front Panel I want to open the VI MASTER and close the VI SLAVE.
Anybody can help me?
Many thanks in advance.
Luca
01-09-2019 08:19 AM
Does it actually need to close or can it just hide the VI and keep it running? This method is much easier and can be done by setting the Front Panel State, through the property node on the VI. If you actually want to stop the execution of the other VI this could probably be done by passing in a reference like a queue or user event and command the other VI to react to it.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
01-09-2019 08:30 AM
Thanks for your answer.
I want to close the runnig VI MASTER and open the VI SLAVE. Then I want to close the running VI SLAVE and re-open the MASTER VI closed. And so on.
01-09-2019 08:38 AM
@LucaMatulli wrote:
Thanks for your answer.
I want to close the runnig VI MASTER and open the VI SLAVE. Then I want to close the running VI SLAVE and re-open the MASTER VI closed. And so on.
By " close the runnig VI MASTER " do you mean;
close the VI and remove it from memory
OR
Close the Front Panel of the running VI
?
Ben
01-09-2019 08:40 AM
Yes, close the VI and remove it from memory.
Many Thanks
01-09-2019 08:52 AM
Why is it necessary to remove it from memory when it is likely you'll be reopening it again?
01-09-2019 08:53 AM - edited 01-09-2019 08:54 AM
Okay here is a quick demo which uses the static VI reference to open a reference, and run the other VI, then close the current one. There are multiple other ways to accomplish this. But I agree a better method would be to keep both VIs in memory, or even both VIs running and then just show or hide one.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
01-09-2019 09:16 AM
Because the VIs are very heavy as memory usage. Now I am hidding the MASTER VI when the SLAVE is runnig but with 2 running VI the pc is slowly.
The MASTER is the MAIN PAGE where the operator write all the data for the test, the VIs SLAVES are different VIs where is possible perform different tests. At the end of each test the procedure expect to come back to the MAIN PAGE again and only from the MAIN it is possible to open a new SLAVE VI for a different test.
01-09-2019 09:25 AM
Okay. As long as you have a good reason. Sometimes people say they want something specific and lock themselves into a specific scenario when if they open up their minds a bit, a simpler and easier solution is available. They are too busy asking questions about how to do something a complicated way rather than posing the question as what they are really trying to do and what is the best way to do that without predetermining the path to take.
Even now, you are talking about 3 slave VI's, when originally you were only talking about 1. So the real problem is 1 main VI and 3 Slave VI's all open at once are all too much memory,
Is the Main VI a heavy memory usage, or just all 3 of the slave VI's?
I would expect the Main VI to be lighter weight. If so, I would have that remain in memory but hidden and just open up the particular slave VI at that time. When the slave is done, it will close itself and pass control back to the main VI still in memory. Then it can go and open the next slave VI.
01-09-2019 09:31 AM
@LucaMatulli wrote:
Because the VIs are very heavy as memory usage. ...
God knows I have written my share of code that requires a lot of memory but I have to ask...
Is the heavy use of memory intended and expected?
Ben