LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Close and open subVIs from main VI


@crossrulz wrote:

@camerond wrote:

Here's an easy way to do it, using a WHILE loop, T/F Case structures and local variables.

 

Cameron

 


Ok, just looked at your example.  Event structure is so much easier.  And to make it even easier on you, use latching buttons.  Then you don't need the locals to reset the buttons.  When the button's terminal is read, the latch will reset.  And I don't see where this is applicable to the OP's question about the subVI's panel not closing


Yeah, I should have used latching controls and left off the LV's. But where this is applicable to the OP's question is that the way he did it, he was right, the subVI's panel did not close on the second reentry. I had to shut down LV to regain control.

 

In my (admittedly pitiful) defense, someone had just taken the last cup of coffee and I wrote that reply before the next pot had finished brewing for my first cup. Smiley Wink

 

Cameron

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 11 of 18
(845 Views)

@camerond wrote:

Wait, wait 250 msec now. I didn't peg the CPU core, I had a quarter-second wait in there between loops. At least I did that right, AFAIK. Didn't I?

 

You may have realized that I'm not a real computer jock by now. The last 18 years or so I've been doing most of my programming in Perl, where TIMTOWTDI is a way of life.

 

Cameron


Yes.  I didn't look at your example until after I made that comment.  My bad.

 

I am a full believer in the KISS (Keep It Simple Stupid).  And polling buttons is complicated when a simple event structure will do it.  This is especially true when you get a decently complicated GUI going.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 12 of 18
(844 Views)

have you tried dynamic loading? loads into memory when called and unloads reference when sub vi exits

**note: make sure sub vi path constant is pointing towards the downloaded folder**

main (random number)_BD.png

0 Kudos
Message 13 of 18
(836 Views)

Thanks for answers. I decided for the following solution...

0 Kudos
Message 14 of 18
(812 Views)

I tried to apply your solution to my work. I prepared simple code where I want to demanstrate the usage. It works fine in the firs case of subVI1, however in case of subVI2 it is not possible to turn it off. There are two loops synchronized by occurence. Please check it .... 

0 Kudos
Message 15 of 18
(802 Views)

@charlie87 wrote:

I tried to apply your solution to my work. I prepared simple code where I want to demanstrate the usage. It works fine in the firs case of subVI1, however in case of subVI2 it is not possible to turn it off. There are two loops synchronized by occurrences. Please check it .... 


  • "I tried to apply your solution to my workyour solution": it is not anything near to what I had offered
  • "I prepared simple code where I want to demanstrate the usage": your vi2 code is convoluted
  • "There are two loops synchronized by occurence": your use of occurrences, sequences and the wrong usage of event structures are not desired in this case
  • I suggest you should look at the online tutorials

note: the concept was about memory loading and unloading of sub vi's and their usage

 

Message 16 of 18
(795 Views)

I'm dealing with the exact same issue right now.  However I use LV 2010 so I am unable to open some of the solutions posted on here.  Can more of you post your suggestions as a bmp (as Apok has done) so I can see your answers?  Thanks!

********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 17 of 18
(714 Views)

To Open the subVI dynamicaly you can use the idea of Apok posted above. The path to the subVI is used to open it by using Invoke Node (Application Control Palette). You need to set the VI properties to Open the Front Panel when loaded. If you want to open a static subVI (always the only one) you can just put the subVI into the event case structure instead of the invoke node and set the VI properties to open FP when loaded again.

To close the subVI it depends if you want to close in the caller (main VI) or the subVI which was open... try to use the VI Server and Invoke Node options such as Abort and Close/Open FP to achieve your solution

0 Kudos
Message 18 of 18
(680 Views)