943,709 Members | Top Members by Rank

Ad:
Aug 27th, 2007
0

How to pause timer control in visual Foxpro?

Expand Post »
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!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
icsantos is offline Offline
6 posts
since Aug 2007
Aug 28th, 2007
0

Re: How to pause timer control in visual Foxpro?

Never mind, I figured it out. I replaced
     IF THISFORM.cmdPause.CLICK()
          MESSAGEBOX("Click OK to resume processing")
     ENDIF
with
     DOEVENTS
     DO WHILE .T.
          IF THISFORM.cmdPause.ENABLED
               EXIT
          ENDIF
          DOEVENTS
     ENDDO
And instead of a single command button that toggled between "Pause" and "Resume", I created a Pause command button and a Resume command button.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
icsantos is offline Offline
6 posts
since Aug 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Legacy and Other Languages Forum Timeline: Oracle Help
Next Thread in Legacy and Other Languages Forum Timeline: query in access 2003





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC