Manuel Lopez-Michelone
asked on
simple chronometer component
Hi guys,
I am looking for a simple chronometer component thats count from N seconds to zero. I found some components on the net but no one that runs backwards. Can anybody write a simple chronometer component. Minimal functionality: stop, pause, reset, running backward or forward...
thanks in advance...
Manuel Lopez (lopem)
I am looking for a simple chronometer component thats count from N seconds to zero. I found some components on the net but no one that runs backwards. Can anybody write a simple chronometer component. Minimal functionality: stop, pause, reset, running backward or forward...
thanks in advance...
Manuel Lopez (lopem)
I once wrote a little component which counts backwards.
This component had 1 event, OnCountFinished that was triggered the moment the counter reaches 0.
Maybe I can adapt it a little so that I can transform it into a chronometer.
Give me your email address and I'll send you this component if it is ready (Could take a while, because I'm pretty busy right now).
Best regards,
The Mayor.
This component had 1 event, OnCountFinished that was triggered the moment the counter reaches 0.
Maybe I can adapt it a little so that I can transform it into a chronometer.
Give me your email address and I'll send you this component if it is ready (Could take a while, because I'm pretty busy right now).
Best regards,
The Mayor.
ASKER
morsa@la-morsa.com
I would really appreciate your effort... I will add 50 more points...
thanks in advance!
best regards
Manuel Lopez (lopem)
I would really appreciate your effort... I will add 50 more points...
thanks in advance!
best regards
Manuel Lopez (lopem)
An extra 50 points ??
I start coding right away now ;-)
I start coding right away now ;-)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks buddy...
I will check it tonight... In the meantime thanks again in advance.
best regards
manuel lopez (lopem)
I will check it tonight... In the meantime thanks again in advance.
best regards
manuel lopez (lopem)
Lets say we want to count seconds and my statrting point is 10 and I want to count it down to 0. What I do is to setup a Timer (disabled) component with an interval of 1000 miliseconds. Now I declare a variable global to my unit and call it maybe iCountDown. Now I set the variable to
iCountDown := 10;
Now I enable the timer and on each cycle I Dec(iCountDown) until it hits 0.
Keep in mind this is a simple approach and not entirely precise in time measurement.
Something like this
var
iCountDown: Integer;
procedure TForm1.Timer1Timer(Sender:
begin
Dec(iCountDown);
Label1.Caption := IntToStr(iCountDown);
if iCountDown <= 0 then Timer1.Enabled := False;
end;
procedure TForm1.Button1Click(Sender
begin
iCountDown := 10;
Label1.Caption := IntToStr(iCountDown);
Timer1.Enabled := True;
end;
The Crazy One