The setTimeout is helpful in JavaScript language. How would you create this function in delphi ?
SetTimeOut(procedure (Sender: TObject);
begin
Self.Counter
Assuming, the function is to be called once and not 5 times every second, maybe like that:
Parallel.Async(
procedure; begin
Sleep(200);
Self.Counter:=Self.Counter+1; end; );
There are more complex solutions like the one you accepted, taking named objects for timer actions and using SetTimer method. Like http://code.google.com/p/omnithreadlibrary/source/browse/trunk/tests/17_MsgWait/test_17_MsgWait.pas Previous versions had SetTimer with anonymous function, but they are gone now.
However for simplistic anonymous closure approach you asked for, maybe Wait(xxX) would fit.