LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How To: display a message during for loop, with no user input necessary

Solved!
Go to solution

Hi Everyone, I'm relatively new to LabView, using 8.5.

 

I want to display a message while a for loop executes, requiring no user input to clear the dialog box (ie, the box disappears after the For Loop ends).

 

Any ideas? 

 

Thanks

Darren

0 Kudos
Message 1 of 15
(5,731 Views)
Do you want the message display to have control while it is up, meaning do you want the user to be able to have access to controls on the front panel of the top level vi while this dialog box is open?
0 Kudos
Message 2 of 15
(5,728 Views)

Hi Darren,

Take a look at this Nugget by Darren* where he posted code for a progress bar to monitor the state of a For loop.

 

Ben

 

* sorry but I could not resist the tempation to use a post by Darren to answer Darren. Smiley Tongue

 

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 15
(5,723 Views)

THanks for the response.

 

I am doing a simple logging task; I have a "for loop" that takes reasdings off a transducer (a displacement device) to get a baseline number, taking these numbers and subtracting them from another displacement reading.  I just want the slight delay in the program while the initial readings are gathered, to have a visual indicator that the system is doing something during the 3-4 seconds that the computer seems to "hang".  Once the readings are over, the dialog box is gone. 

 

Basically the dialog would not prevent the VI from running, it's just a message.

 

THanks

 

0 Kudos
Message 4 of 15
(5,717 Views)

That might just do the trick.  I'll have a look after lunch, and post back if it's a good match.

 

Thanks

Darren

0 Kudos
Message 5 of 15
(5,712 Views)

Ben wrote:

Hi Darren,

Take a look at this Nugget by Darren* where he posted code for a progress bar to monitor the state of a For loop.

 

Ben

 

* sorry but I could not resist the tempation to use a post by Darren to answer Darren. Smiley Tongue

 

 


Cool nugget!  I was going to launch a parallel process using a notifier but this is much simpler.

0 Kudos
Message 6 of 15
(5,706 Views)
You could set the mouse pointer to busy when you start the loop and unset it when it's done.
Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 7 of 15
(5,667 Views)

I must be going about this the wrong way.  I've got the "for loop", with a Daq assistant inside taking data from my transducer.  I've got 10 "samples to read" at a rate of 2 hz, so that should take 5 seconds.  I've got 1 loop iteration, so it should only perform this data gather just once (so a total of 10 samples). 

 

I've changed the parameter in the "nugget" progress bar so that it ldoes nothing for the first 1 ms (something very small, so that it works immediately), which follows that the loop should be still running after 1 ms, it then looks to see if it is more than 0.99 (I changed from the default 0.5) done with the loop iterations, and if so, does nothing  - but to read for 5 seconds, this should always be showing......I'm doing something incorrect....

 It will work if I put in more than 1 loop (I tried 5 and it works nicely, but I don't need that many samples). 

 

Ideas??

 

from the original nugget explanation: 

"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)."

 


Ben wrote:

Hi Darren,

Take a look at this Nugget by Darren* where he posted code for a progress bar to monitor the state of a For loop.

 

Ben

 

* sorry but I could not resist the tempation to use a post by Darren to answer Darren. Smiley Tongue

 

 


 

0 Kudos
Message 8 of 15
(5,649 Views)
It looks like the Progress Bar VI never enters the default case of the initial case structure.  It doesn't look like this VI was designed to use with for loops that only have one iteration.  If you know that your time will always be five seconds you could use the Elapsed Time VI and calculate the time remaining until the aquisition is done.
Regards,

Jon S.
National Instruments
LabVIEW NXG Product Owner
0 Kudos
Message 9 of 15
(5,626 Views)
Take a look at the attached VI's.  They will display a popup busy display with a programmable title.  The start and stop busy signal is sent using an Action Engine.  In you code you would remove the wait ms timer with error function and replace that with your 1 iteration for loop.  Let me know if you have any questions.
0 Kudos
Message 10 of 15
(5,611 Views)