Code for Class SwatchEngine


*-- Method TmrSWEngine.Time()
Swatchengine::Timer()
this.Parent.refresh()

*-- Method Swatch.Refresh()
LOCAL lcTime, ;
   lnSecs, ;
   lnHours, ;
   lnMins, ;
   lcSecs, ;
   lnLen

this.nSecs = this.tmrSWEngine.nSecs
this.nStart = this.tmrSWEngine.nStart
   
*-- Take the number of seconds on the clock (nSecs property)
*-- and convert it to a string for display.

lcTime    = ""
lnSecs    = this.tmrSWEngine.nSecs

lnHours    = INT(lnSecs/3600)

lnSecs    = MOD(lnSecs,3600)
lnMins    = INT(lnSecs/60)

lnSecs    = MOD(lnSecs,60)

lcSecs = STR(lnSecs,6,3)
lnLen = LEN(ALLT(LEFT(lcSecs,AT('.', lcSecs)-1)))
lcSecs = REPL('0', 2-lnLen) + LTRIM(lcSecs)

lnLen     = LEN(ALLT(SUBST(lcSecs,AT('.', lcSecs)+1)))
lcSecs = RTRIM(lcSecs) + REPL('0', 3-lnLen)

lcTime = PADL(lnHours,2,'0') + ":" + ;
            PADL(lnMins,2,'0') + ":" + ;
            lcSecs
     
this.lblTime.Caption = lcTime

*-- Method Swatch.Stop()
this.tmrSWEngine.Stop()

*-- Method Swatch.Start()
this.tmrSWEngine.Stop()

*-- Method Swatch.Resume()
this.tmrSWEngine.Resume()

*-- Method Swatch.Pause()
this.tmrSWEngine.Pause()

*-- Method Swatch.Reset()
this.tmrSWEngine.nSecs = 0
this.Refresh()