TProc here is anonymous function type declared in SysUtils unit.
setTimeout returns integer Id of timeout. One may cancel running timeout using cancelTimeout function. Everything is like in JavaScript.
Now you may setup timeout inplace.
My realization of setTimeout function may be downloaded from here.
Note:
The "timeouted" procedure is called in main program thread context.
So code like this:
will not work as wanted and ShowMessage will be called after exit from procedure TForm1.Button1Click(), until you make periodic calls to Application.ProcessMessages from SomethingLongRunning
Thank for funntion. i looking for it long time :D
ОтветитьУдалитьHello, can you reshare it with us? If you try to download the `xds_timers.pas` file the link return "403 Forbidden". Thank you!
ОтветитьУдалить