Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (
- local startTime
- local stopTime
- local startTheClock = false
- try destroyDialog ::roStopwatch catch()
- rollout roStopwatch "Stopwatch"
- (
- button btnStart "Start" width:100 height:25 across:2
- button btnStop "Stop" width:100 height:25
- label lblTime "" align:#left offset:[75,0]
- -- timer timerDisplay "" interval:50 --tick once a second
- -- on timerDisplay tick do
- -- (
- -- if startTheClock == true do
- -- (
- -- lblTime.text = ((timeStamp() - startTime) / 1000.0) as string
- -- )
- -- )
- on btnStart pressed do
- (
- startTime = timeStamp()
- startTheClock = true
- )
- on btnStop Pressed do
- try(
- startTheClock = false
- stopTime = timeStamp()
- timeTaken = ((stopTime - startTime) / 1000.0)
- lblTime.text = timeTaken as string + " Seconds"
- )catch()
- )
- createDialog roStopwatch width:230 height:60 pos:[10,150]
- )
Add Comment
Please, Sign In to add comment