11-05-2008 09:47 AM
Hi Friends,
Currently i am in a requirement to add a pause button to my applciation.
My application in detail is involved with lot of sub VI's and the entire VI structure is the frame sequence.
So i want to provide the user a provision to press a pause button which pauses the entire operations for a while and proceeds once he re-clicks the same.
Please help me in providing any exapmles if u are having the same requirement.
waiting for ur reply with examples
Regards,
Suneel.V
11-05-2008 10:00 AM
Suneel.V
It will be difficult to do what you want with your current architecture. A sequence structure will execute each frame in sequence until all are finished.
If you convert it to a state machine architecture, then at the completion of any state the pause button could cause the next state to be an Idle state. There are shipping examples of state machines, although I do not recall whether any have a Pause. I have written many programs with pause.
Lynn
11-05-2008 10:05 AM
John,
You are correct,
But i know the entire flow of my operation will be done in a particular frame No:3.
So i am planning to add a Case structure with a While loop internally.
The control of the while loop i will give it to the user.
Does it works?
Add ur comments.
Regards,
Suneel.V
11-05-2008 10:08 AM
11-05-2008 10:15 AM
Suneel.V,
That may work. Put a small delay or wait inside the loop so that it does not become a greedy loop and consume all available CPU cycles. Look closely at the dataflow inside that frame to make sure that the pause will actually stop whatever is going on. You may need to put everything inside the while loop with a case structure connected to the Pause button. Whether that will work depends on how the task is configured when not paused.
Even if you get it to work now, be aware that the next modification or the one after that will be more difficult to get working. At some point the time it takes to rewrite it as a state machine will be worth the effort.
Lynn
07-15-2010 10:27 AM
Yeah, that worked pretty much; Another thought: What about an OK button? Could we make it popup a window with a message, and have the program sit idle and wait for me to click OK or something?
07-15-2010 11:35 AM
braber,
You posted to a thread which is almost two years old. It might have been better for you to start a new thread and completely describe what you are trying to do and what probelms you are having doing it. Your comment was not very clear: What worked? And what did not quite work the way you expected?
Certainly pop-up subVIs have been used for a long time.
Lynn