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:
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 timer
cmdPause.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.
ENDIF
The 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!