Example Program Drafts

cancel
Showing results for 
Search instead for 
Did you mean: 

Quit LabVIEW (Conditional)

Readme file for Quit LabVIEW (Conditional) VI

Description

If you have ever built a VI that uses the native Quit LabVIEW function, then you have most likely had to deal with LabVIEW closing while you are developing or debugging your VI or any of its sub VIs. Nothing is more frustrating than making changes to several sub VIs, checking that the changes work as expected when the changed code is executed as part of your main VI and then watching LabVIEW close -- just as you remember that you did not save those changed VIs.

So, how do you keep LabVIEW from closing when you need to edit or debug your main VI or any of its sub VIs? Some typical methods for preventing LabVIEW from closing when developing or debugging your code are to remove the Quit LabVIEW function temporarily, write code to disable it or set a breakpoint before you call the Quit LabVIEW function. Then you must remember to undo those changes when your development work is complete. The Quit LabVIEW (Conditional) VI can help to reduce this frustration.

The Quit LabVIEW (Conditional) VI quits LabVIEW if the number of VIs in the caller's hierarchy and the  number of VIs currently in memory is equal (This means that no other VIs are in memory, so it's safe to quit LabVIEW). Otherwise the Quit LabVIEW (Conditional) VI takes the action on the caller's front panel as specified by the "Action if not quitting LabVIEW" input. Run the included example VI to see how you can use this functionality in your applications.

This VI uses the Retrieve Hierarchy VI, which can be downloaded from: http://zone.ni.com/devzone/cda/epd/p/id/2094.

Application Software

LabVIEW 2010 or higher

Driver Software

None.

Description of Operation

Perform the following steps to see how the Quit LabVIEW (Conditional) VI works.

- Open any other VI.
- Run the included example VI.
- Select the action to take if not quitting LabVIEW.
- Press the Stop button.

Notice that LabVIEW is not shut down if any other VI is in memory and the front
panel of the example VI closes or remains open based on the setting of the
"Action If Not Quitting LabVIEW" control.

- Close all other VIs except for the included example VI.
- Run the example VI.
- Press the Stop button.

Notice that LabVIEW is shut down if no other VIs are in memory. The setting of
the "Action If Not Quitting LabVIEW" control is ignored in this case.

Extracting the files

The Quit LabVIEW (Conditional) VI is supplied as a zip archive containing all required items.

Additional Information

Additional information related to the use and operation of the Quit LabVIEW (Conditional) VI may be accessed via:

  • The block diagrams of all included VIs
  • The documentation within all included VIs

Block Diagram Screenshots

(NOTE: Click on an image to see an enlarged view.)

Diagram1.JPG

Diagram2.JPG

Diagram3.JPG

Diagram4.JPG


Developed by

Mark Ridgley

Mark.Ridgley_LabVIEW.Developer@comcast.net
Comments
Active Participant Todd S.
Active Participant

thanks for posting! could you please post a screenshot of the BD when you get a chance?

Todd S.
LabVIEW Community Manager
National Instruments
Member Mark.Ridgley Member
Member

Hi, Todd

As you requested, I have posted block diagram screenshots as a new section in the body of the document. Let me know if you need anything else.

Active Participant Todd S.
Active Participant

Awesome!!! Thanks!

Todd S.
LabVIEW Community Manager
National Instruments
Member Evan R.
Member

Mark, cool example! I have been using a similar conditional quit with a bit of a spin - I only ever quit LabVIEW if the execution environment is set to runtime. This way, LabVIEW will never close in the development environment, and will certainly close when running as an executable.

That being said, I like your approach or perhaps some hybrid on account of the fact that my conditional quit will shut the program down regardless of whether or not dynamically loaded VIs are still running.

I'll post mine in a moment and then trackback.....

Member Evan R.
Member

Here is the example I mentioned: http://decibel.ni.com/content/docs/DOC-4981

Contributors