Board index » delphi » Timer countdown or CountUp!?!?!

Timer countdown or CountUp!?!?!

Hello,

I Think that this is the wrong Newsgroup for this question, but i will try
it anyway......

i have wrote a app. that needs a timer, a counter that tell's the user how
long he has been using the program, the timer should show it self in the
Caption of the form.

To show it a caption of the form is not the problem, but counting seconds is
the problem,

So i need a routine that counts seconds and display's it as 01:28

So the caption of the form should be:

Calculator Plus (this program is now 01 minutes and 28 seconds active)

Please Help!

Thanks in advance,

Marc.
mdonk...@pcfun.nl

 

Re:Timer countdown or CountUp!?!?!


Set the 'TTimer.Interval' to something like 300 ms and set the OnTimer event
to this procedure:

procedure Timer1Timer(Sender: TObject);
  const
    Ticks: Integer = 0;
begin
  if GetTickCount - Ticks >= 1000 then begin
    <Increase your seconds counter and update display>
    Inc(Ticks, 1000);
  end;
end;

Donk <mdonk...@pcfun.nl> skrev i
diskussionsgruppsmeddelandet:7u6vdu$rd...@news.telekabel.nl...

Quote
> Hello,

> I Think that this is the wrong Newsgroup for this question, but i will try
> it anyway......

> i have wrote a app. that needs a timer, a counter that tell's the user how
> long he has been using the program, the timer should show it self in the
> Caption of the form.

> To show it a caption of the form is not the problem, but counting seconds
is
> the problem,

> So i need a routine that counts seconds and display's it as 01:28

> So the caption of the form should be:

> Calculator Plus (this program is now 01 minutes and 28 seconds active)

> Please Help!

> Thanks in advance,

> Marc.
> mdonk...@pcfun.nl

Other Threads