Sleep function

Sleep function

Post by Stev » Fri, 04 Jul 2003 22:49:16



Sleep function is not working properly. Specially in a loop which I want to
move an image step by step to simulate a moving image (say from left to
right)

How can I solve the problem?

 
 
 

Sleep function

Post by Liran Shaha » Sat, 05 Jul 2003 12:52:18


Quote:>Sleep function is not working properly. Specially in a loop which I want to
> move an image step by step to simulate a moving image (say from left to
> right)

Sleep will cause the system to "Sleep" which means no messages in the meantime,
you can write something like this:

procedure Form1.delay(const ms: Longint);
var
    TheTime : LongInt;
begin
    TheTime := GetTickCount + ms ;
    while GetTickCount < TheTime do Application.ProcessMessages ;
end;

This should be better...
--
Liran
www.com-n-sense.com