Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Custom Countdown Clock

Keywords: 	  custom countdown clock

;-----------------------------------------------------------------------------------
:init

btn = 0
starttime = timeymdhms()
endtime = timeadd(starttime,"00:00:00:00:00:3600")

LTGRAY="192,192,192"
BLACK="0,0,0"

;-----------------------------------------------------------------------------------
:main

wbid = 1
BoxesUp("100,300,500,600",@normal)
BoxCaption(wbid,"Countdown Timer")
BoxColor(wbid,LTGRAY,0)
BoxDrawRect(wbid,"0,0,1000,1000",2)
BoxTextFont(wbid,"Arial",70,60,0)
BoxTextColor(wbid,BLACK)

BoxDrawText(wbid,"5,5,1000,1000",starttime,1,0)

BoxButtonDraw(wbid,1,"Exit now","25,875,200,975")
BoxDataTag(wbid,"here") ; to control the stack

while !btn
btn = BoxButtonStat(1,1)
Timedelay(.1)
now = timeymdhms()
secs = timediffsecs(endtime,now)
diff = timediff(endtime,now)
BoxDrawText(wbid,"70,500,1000,1000",diff,1,0)
BoxDrawText(wbid,"700,875,1000,1000",secs,1,0)
if secs == 0 then break
if secs mod 10 == 0 then boxdataclear(wbid,"here") ; don't let the stack overflow!
endwhile 

boxdestroy(wbid)
;message("Timeout",btn)

;-----------------------------------------------------------------------------------
:END
exit