Atozed Forums
IWTimer - How to start the timer again? - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: IWTimer - How to start the timer again? (/thread-2279.html)



IWTimer - How to start the timer again? - I.Igor - 02-11-2021

Hello.
I am using Intraweb 15.2.20.
If I stop the timer and then start it again, then the timer does not start counting from the beginning, but ends the time that was not finished before the last stop.
IWTimer1.Enabled := false;
IWTimer1.Enabled := true;
// after assigning a value Enabled := true event OnAsyncTimer will occur in the interval 0.. IWTimer1.Interval

I tried like this:
IWTimer1.Enabled := false;
IWTimer1.Interval := 5000;
IWTimer1.Enabled := true;
However, that does not work either. The first actuation of the timer after these commands can be less than 5 seconds.

Is there a command to start the timer from the beginning?


RE: IWTimer - How to start the timer again? - Alexandre Machado - 02-11-2021

I'll run some tests and let you know ASAP


RE: IWTimer - How to start the timer again? - Alexandre Machado - 02-13-2021

the issue here is that when you do this:

Code:
procedure TIWForm1.IWEdit1AsyncKeyDown(Sender: TObject;
  EventParams: TStringList);
begin
  StartTime := Now;
  IWTimer1.Enabled  := false;
  IWTimer1.Enabled  := true;
  laStartTime.Caption := TimeToStr(StartTime);
end;

you are not actually disabling and enabling the timer. The state actually didn't change so it keeps running.

I'm doing a little modification to our code to reset the timer in such a scenario. Stay tuned for a new update.

Cheers


RE: IWTimer - How to start the timer again? - Alexandre Machado - 02-14-2021

Please update to 15.2.24. It should be working according to your expectations now.

Cheers