[DUG] TTimer

John Bird johnkbird at paradise.net.nz
Thu Jul 20 11:10:41 NZST 2006


I have a couple of applications with a timer loop that is prone to
occasionally freezing after a few hours, not doing  anything radical, for
example displaying a date and time.

procedure TfrmJBCLMenu1.Timer1Timer(Sender: TObject);
begin

  lblToday.caption:=formatDateTime('dd mmm yy - hh:nn:ss',now);

end;


I noticed when the timer has stopped running that the rest of the
application runs ok, but seems also a bit sluggish, that is buttons respond
but slowly.

I put a bit of wake up code run when certain buttons are pressed like

//clock sometimes freezes...
procedure TfrmJBCLMenu1.WakeClock;
begin
  timer1.Enabled:=false;
  sleep(500);
  timer1.Enabled:=true;
end;

But I am thinking this shouldn't be needed!, and I am not sure it always
fixes it anyway.

Any suggestions to stop timers freezing?  Any known problems?

John



More information about the Delphi mailing list