Question

I run this code:

1.THIS.ENABLED = .F.     && suspend timer
2.
3.lnTotFiles = ADIR(laFiles, "*.ERA")
4.FOR lnCntFiles = 1 TO lnTotFiles
5.     DO myprocess WITH laFiles[lnCntFiles,1]
6.     IF THISFORM.cmdPause.CLICK()
7.          MESSAGEBOX("Click OK to resume processing")
8.     ENDIF
9.NEXT lnCntFiles
10.
11.THIS.ENABLED = .T.   && reactivate timer

The problem is, THISFORM.cmdPause.CLICK() in the Timer event always returns .T. whether or not I click on the Pause command button.

cmdPause.CLICK() containes this:

1.IF THISFORM.cmdPause.CAPTION = "Pause"
2. THISFORM.cmdPause.CAPTION = "Resume"
3. THISFORM.tmrChkDir.ENABLED = .F. 
4.ELSE 5. THISFORM.cmdPause.CAPTION = "Pause" 
6. THISFORM.tmrChkDir.ENABLED = .T. 
7.ENDIF 

So how should I test if the Pause button was clicked within the FOR-NEXT loop in the Timer event?

Was it helpful?

Solution

try this:

THIS.ENABLED = .F.     && suspend timer
lnTotFiles = ADIR(laFiles, "*.ERA")
FOR lnCntFiles = 1 TO lnTotFiles
DO myprocess WITH laFiles[lnCntFiles,1]
DOEVENTS     
DO WHILE .T.
IF THISFORM.cmdPause.ENABLED
EXIT
ENDIF
DOEVENTS
ENDDO
NEXT lnCntFiles
THIS.ENABLED = .T.   && reactivate timer
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top