NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Trusted Enthusiast
Darren
Posts: 2,614

Darren's Weekly Nugget 06/26/2006

Hi all,
 
I've discussed the following trick a few times in the past on the forums, but I thought I'd make it an official nugget today.  I've attached a VI below called "For Loop Progress Bar", saved in LabVIEW 7.0.  This is a brainless little VI I wrote a long time ago that I stick in a For Loop whenever it's going to take a while and I want my user to be able to see a progress bar indicating approximately how much more time he'll be waiting.  All you have to do is drop this in a For Loop, and wire both the 'i' and the 'N' terminals, along with a message for the user to see...like so:
 
In its default configuration, this VI does nothing during one second's worth of iterations of the For Loop.  If after one second, the For Loop is still running, the subVI checks to see if the loop is over halfway done with its iterations.  If it is, then the subVI continues to do nothing for the remainder of the iterations.  If, however, the loop is less than halfway done, the subVI shows its front panel, which is simply a progress bar indicating what percentage of iterations the For Loop has gone through.  I find this VI is a great way to indicate to users that my main VI is actually doing something.  The subVI also has a Wait Time input that lets you change the default wait time if you think one second is too long to wait (or too short).
 
I know some of my colleagues have taken this VI and modified it to be used inside a While Loop as well (so it can have a Cancel button).  I imagine this would be a pretty easy modification to make, but I'll leave that as an exercise for the reader.  :smileyhappy:
 
-D
 
P.S. - Check out past nuggets here.
Darren Nattinger, CLA
LabVIEW Artisan and Nugget Penman
By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page