Timer Pause script
DunbarX at aol.com
DunbarX at aol.com
Mon Jul 12 09:23:10 EDT 2010
I made a stopwatch a while ago. Make a button and name it "start". Make
another button and name it "reset". Make a field and name it "timer".
In the script of button "start":
on mouseDown
lock screen
if the label of me = "start" then
set the label of me to "stop"
set the startingTime of me to the milliseconds
replace "." with empty in fld "timer" --temp
set the oldTime of me to fld "timer"
send "countUp" to me in 1 millisecond
else
set the label of me to "start"
end if
end mouseDown
on countUp
put (the milliseconds - the startingTime of me) + the oldTime of me
into temp
put "." before char the number of chars of temp -2 of temp
if the length of temp <= 4 then put "0" & temp into fld "timer" else
put temp into fld "timer"
if the label of btn "start" = "stop" then send "countUp" to me in 1
millisecond
end countUp
In the script of button "reset":
on mouseUp
cancel item 1 of the last line of the pendingmessages
set the label of btn "start" to "start"
put "0" into fld "timer"
end mouseUp
More information about the use-livecode
mailing list