09-14-2009 11:03 AM
Hi,
When I run the user interface and click on a button that sweeps voltage for a period of time, I can not press any other button that is on my panel, lets say, Abort button that would stop the action.
So, when I'm taking data and I realize that I should stop it before it finishes the sweep, I can't and that is a really bad disadvantage.
how can I improve this problem?
Thanks
Solved! Go to Solution.
09-14-2009 11:28 AM
There are better solutions, but a quick fix might be to simply include a call to ProcessSystemEvents(), somewhere in your time-consuming "sweeps voltage" loop. This will allow CVI to check for any button clicks.
For the future, you might want to investigate the use of Asynchronous Timers or MultiThreading, in order to perform intensive activities while retaining GUI responsiveness.
JR
09-14-2009 11:57 AM
Hi,
Thanks, I added ProcessSystemEvents in the sweep loop, but still, when i click the Quit button, it doesn't quit right a way, it finishes the sweep and then quits the panel. the other buttons work though.
I need to be able to stop the sweep in the middle of its execution and this can be done either by quiting the panel( bad choice) or calling the abort funcion which when it's pressed, a global variable which is always at zero turns one, and the if statement breaks the function.
09-14-2009 02:04 PM - edited 09-14-2009 02:05 PM
Hi,
I could not quite understand your problem.
The ProcessSystemEvents function should do the trick in your case.
Does not your abort callback execute when you press the button?
If it does, why can't you use it to set a flag to finish your loop?
Can you put a breakpoint in your abort callback to be sure it is executed?
09-14-2009 05:07 PM
Hi m.s.taba,
it seems to me that your code executes the quit function but does not exits the loop you are in, so the program quits only at the end of the loop.
To prevent this you could: