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