Greeting to all, i am trying to put a simple timer in some applications not lucky so far... i will appreciate some help about this:
have you seen the timer when you hit "Start" the timer start to count seconds and and then minutes and then hours, so you hit the "Stop" button and the timer stop or even better hit the pause button and then "start" again and the timer continue counting..
Thanks so much in advance
Greg Garcia
COUNTING TIMER
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 33
- Joined: Mon Apr 27, 2009 3:32 pm
- Location: Coatzacoalcos, Veracruz, Mexico
- Contact:
-
- Posts: 33
- Joined: Mon Apr 27, 2009 3:32 pm
- Location: Coatzacoalcos, Veracruz, Mexico
- Contact:
Re: COUNTING TIMER
i am apologize i could find some hits using the search option in the forums, but i found the answer very similar that i was looking for under the subject "multiple timer"... thanks now the timer is timing...
Greg Garcia
Greg Garcia
-
- VIP Livecode Opensource Backer
- Posts: 9670
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: COUNTING TIMER
This is a wonderful exercise to learn to program. There are probably a thousand timers out there. Make your own.
As a start, and this is very crude, make two buttons and a field. In the first button, which you will name "start", place these handlers:
In the second button, named "Reset", place this handler:
Name the field "timer".
Check it out. We are using a custom property, and more importantly, sending a message in time. You might try rewriting this with a repeat loop in the "start" button, checking for the status of certain criteria. The timer only gives seconds. Rewrite it to your favorite format.
Craig Newman
As a start, and this is very crude, make two buttons and a field. In the first button, which you will name "start", place these handlers:
Code: Select all
on mouseUp
if the label of me = "start" then
set the label of me to "stop"
set the startingTime of me to the seconds
set the oldTime of me to line 1 of fld "timer"
send "countUp" to me in 1
else
set the label of me to "start"
end if
end mouseUp
on countUp
put (the seconds - the startingTime of me) + the oldTime of me into fld "timer"
if the label of btn "start" = "stop" then send "countUp" to me in 1
end countUp
Code: Select all
on mouseUp
put "0" into fld "timer"
set the label of btn "start" to "start"
end mouseUp
Check it out. We are using a custom property, and more importantly, sending a message in time. You might try rewriting this with a repeat loop in the "start" button, checking for the status of certain criteria. The timer only gives seconds. Rewrite it to your favorite format.
Craig Newman
-
- Posts: 33
- Joined: Mon Apr 27, 2009 3:32 pm
- Location: Coatzacoalcos, Veracruz, Mexico
- Contact:
Re: COUNTING TIMER
Dumbark sorry for the late reply, thanks for comment, now the timer is working..
best regad
Greg
best regad
Greg