I wrote a simple graphical program. It seemed to work, but when I clicked the Button (Button1), the program became unresponsive and began to respond only when the assigned procedure ended. I was using the simple Repeat...Until loop. Here's the procedure:
procedure TSlashForm.Button1Click(Sender: TObject);
begin
Repeat
//some code
until //some condition;
end;
If I click the form during the execution of the loop, the whole program becomes unresponsive and crashes. To fix this, I have tried to use
SlashForm.Update;
and
SlashForm.Refresh;
but none of these seemed to work. How can I avoid the unresponsive state?
Or call application.processmessages in the loop every 100-1000 iterations or so. (or roughly 5-10 times a second if you have slow iterations)