PDA

View Full Version : [LAZARUS] Alternate to Sleep()?



Footy
11-26-2012, 08:35 PM
When making apps in lazarus, whenever I use sleep, it does weird things. For example, I can't close the screen while its sleeping, I can't resize it, no Onclick events can be called, everything freezes for however long it's sleeping. Is there an alternative to sleep that will still keep everything functional?

Thanks :D
Footy

E: Found this suggestion online. The only downside is when I am moving a screen, everything stops, but atleast it's better then it was.


Procedure FSleep(Time : Integer);
var
i:integer;
begin
for i := 0 to Time do
begin
sleep(1);
Application.ProcessMessages;
end;
end;

Killerdou
11-26-2012, 10:35 PM
to prevent the counting to stop you could have it loop untill time passed is big enough, rather than sleep(1) as many ms as you would like to sleep