I've tried starting it off, but to be honest I have no idea where to go from here:
procedure TForm1.CreateTimer;
var
NewTimer: TTimer;
begin
NewTimer := TTimer.Create(Self);
with NewTimer do
begin
;
Interval := 1000;
Enabled := True;
end;
end;
Before activating the timer, you should set a handler for the
OnTimer event; otherwise the only thing your timer does is to waste resources
![Grin ;D](/Smileys/ExcellentSmileys1/acute.gif)
procedure TForm1.TimerTimeout(Sender: TObject);
begin
{Do whatever when the timer shots an OnTimer event}
end;
procedure TForm1.CreateTimer;
{Declared as form field or global: NewTimer: TTimer}
begin
if not Assigned(NewTimer) then begin
NewTimer := TTimer.Create(Self)
with NewTimer do
begin
Interval := 1000;
OnTimer := @TimerTimeout
Enabled := True;
end;
end;
end;
Now all you have to do is to fill up the handler (
TimerTimeout) to do whatever you want: update a label showing the time, invoking a temporal file update proc, etc.
HTH
ETA: I have a very simple "clock" application which demonstrates how to use a TTimer; I'll post it if you want but
only if this is not for school work (
copy-paste homework is very bad for your intellect!)