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. 🙂
-D
P.S. - Check out past nuggets
here.