Stuck in a wait lazarus / 13-General ---------------------------------------------------------------------- w click · 2011-06-24 10:43 I've written a procedure that causes the program to wait, but I can't find a way to interrupt it with a key press. Quote    while now0 do   begin     //your code here     Form1.Caption:='Timer:'+IntToStr(Timer);     Application.ProcessMessages; //allow events to be processed     Sleep(1000); //sleep for one sec     Dec(Timer);   end;   Form1.Caption:='Time out finished'; end; end. ---------------------------------------------------------------------- w click · 2011-06-25 14:55 Application.processmessages did the trick and, once I'd sorted out my regular issue with getting things to refresh, it all looks good now.  Many thanks. To be fair to Lasken, that would be intelligent, but I'd have to turn my whole program inside out. Thanks all.