MikeA
2010-06-03 03:57:32 UTC
Here's an interesting question:
I've seen some programs where there's a button you can click on to "PAUSE"
execution or even QUIT. I'm trying to figure out the best way to do this
when program code is executing. I know the click event MIGHT respond once
current code is done executing. I know I could use MouseMove and let the
user just keep the cursor over a button until the current code is done and
then it mousemove code will execute but I think that is rather sloppy and a
click event is a better way to go.
I put two buttons on a form. The first button's click event has this:
lnSec = int(seconds())
do while lnSec + 15 > seconds()
enddo
acti screen
? "DONE"
This causes VFP to use a lot of CPU cycles. Now, the question is how can I
throw a second button on the form so that if they click it the caption will
immediately change to something like OK or Please Wait or Resume...etc. In
addition, I could set a property so that the current code executing or a
timer could take action from there.
I notice that in the tight loop if they click a second button where I have
something like MessageBox("CLICKED") that the click event never even fires
at all (if it is clicked early on in the above tight loop.
Any ideas before this forum comes to a close?
Thanks,
Mike
I've seen some programs where there's a button you can click on to "PAUSE"
execution or even QUIT. I'm trying to figure out the best way to do this
when program code is executing. I know the click event MIGHT respond once
current code is done executing. I know I could use MouseMove and let the
user just keep the cursor over a button until the current code is done and
then it mousemove code will execute but I think that is rather sloppy and a
click event is a better way to go.
I put two buttons on a form. The first button's click event has this:
lnSec = int(seconds())
do while lnSec + 15 > seconds()
enddo
acti screen
? "DONE"
This causes VFP to use a lot of CPU cycles. Now, the question is how can I
throw a second button on the form so that if they click it the caption will
immediately change to something like OK or Please Wait or Resume...etc. In
addition, I could set a property so that the current code executing or a
timer could take action from there.
I notice that in the tight loop if they click a second button where I have
something like MessageBox("CLICKED") that the click event never even fires
at all (if it is clicked early on in the above tight loop.
Any ideas before this forum comes to a close?
Thanks,
Mike