| | |
How to pause timer control in visual Foxpro?
Please support our Legacy and Other Languages advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
I created a form containing a timer control named tmrChkDir and a command button named cmdPause. What I need help on is how to check if the user clicked on the cmdPause button while the Timer event of tmrChkDir is in progress, and pause execution until another mouse click occurs.
For example, within the Timer event of tmrChkDir, I have this code:
cmdPause.click() contains this code:
The problem is,
So how should I test if the Pause button was clicked within the FOR-NEXT loop in the Timer event?
Any help would be greatly appreciated. Thanks!
For example, within the Timer event of tmrChkDir, I have this code:
THIS.ENABLED = .F. && suspend timer
lnTotFiles = ADIR(laFiles, "*.ERA")
FOR lnCntFiles = 1 TO lnTotFiles
DO myprocess WITH laFiles[lnCntFiles,1]
IF THISFORM.cmdPause.CLICK()
MESSAGEBOX("Click OK to resume processing")
ENDIF
NEXT lnCntFiles
THIS.ENABLED = .T. && reactivate timercmdPause.click() contains this code:
IF THISFORM.cmdPause.CAPTION = "Pause"
THISFORM.cmdPause.CAPTION = "Resume"
THISFORM.tmrChkDir.ENABLED = .F.
ELSE
THISFORM.cmdPause.CAPTION = "Pause"
THISFORM.tmrChkDir.ENABLED = .T.
ENDIFThe problem is,
THISFORM.cmdPause.CLICK() in the Timer event always returns .T. whether or not I click on the Pause command button.So how should I test if the Pause button was clicked within the FOR-NEXT loop in the Timer event?
Any help would be greatly appreciated. Thanks!
Never mind, I figured it out. I replaced
with
And instead of a single command button that toggled between "Pause" and "Resume", I created a Pause command button and a Resume command button.
IF THISFORM.cmdPause.CLICK()
MESSAGEBOX("Click OK to resume processing")
ENDIF DOEVENTS
DO WHILE .T.
IF THISFORM.cmdPause.ENABLED
EXIT
ENDIF
DOEVENTS
ENDDO![]() |
Similar Threads
- Visual Basic Timer/Clock/Countdown. (Visual Basic 4 / 5 / 6)
- ASP.Net timer control (ASP.NET)
- Timer question: Scoreboard (VB.NET)
- Timer Control Help (VB.NET)
- Help Using Visual Basic Timer (Visual Basic 4 / 5 / 6)
- FoxPro 7.0 - Tutorial Website Needed (MS Access and FileMaker Pro)
Other Threads in the Legacy and Other Languages Forum
- Previous Thread: Oracle Help
- Next Thread: query in access 2003
| Thread Tools | Search this Thread |





