04-11-2020 02:03 PM
You can get significantly better help if you would actually attach a set of simplified VIs that show the problem. There are way too many variables that are not visible in a truncated image.
04-11-2020 02:25 PM
I attached simplified VIs.
Currently the problem is when I open the main VI, then pressing the subvi1 button, then press "return to main menu", it works the first time. The second time, it closes everything (not opening the subvi1)
The other buttons don't work,they are just there because they are in my original program too.
04-11-2020 02:43 PM
(It typically helps to name Vis a bit more uniquely. I have many VIs called subvi.vi in my downloads folder, so the browser renamed it to subvi(3).vi, no longer correctly found by the main vi.)
Why is the main VI reentrant?
04-11-2020 02:46 PM - edited 04-11-2020 02:47 PM
Because I also call the main vi from a sub vi, then I get an error: "You cannot make a recursive call in a non-reentrant VI. That is, a non-reentrant VI cannot call itself as a subVI. "
Sorry about the naming, didn't think about it.
04-11-2020 02:51 PM - edited 04-11-2020 02:52 PM
Well, untangle that convoluted mess and just hide the main Vi instead of closing it. Use asynchronous calls and notify the main VI whenever subVIs complete so it can unhide itself.
04-11-2020 03:05 PM - edited 04-11-2020 03:09 PM
See if this can give you some ideas...
NOTE: make sure the subVI is closed before running the main VI!
04-11-2020 03:05 PM
I tried hiding the main front panel and using Asynchronous Call as one of the first comments in this post suggested. I get an error that I don't know how to solve "(Hex 0x412) attempted recursive calling back the main VI from the subVI.
I attached the picture from the subVI of execution of the Asynchronous Call, maybe I did it wrong?
Thank you and everyone who is helping me so far!
04-11-2020 03:06 PM
Look at my example above instead.
04-11-2020 03:08 PM
Hmmm, this is sounding stranger and stranger.
What are you really trying to do? Don't talk in terms of "open thie VI, close that VI", talk in terms of what you want the User to think is happening. Are you trying to program a "Pop-up", what I've seen called a "Modal Dialog Box", something that "pops up, maybe asks a Question, maybe has a "Fill in the Blank" and some buttons ("OK", or "Yes" and "No"), and when the User fills in the blanks and pushes the right button, it "goes away" and hands the results to the underlying calling routine? [I'm thinking along these lines because I just wrote a few of these ...].
Bob Schor
04-11-2020 03:14 PM - edited 04-11-2020 03:15 PM
Problem solved!
Thank you and everyone who have helped me so far!!!!