Forum > LCL
Cancel a procedure from another procedure
theo:
I think I understand now ;-)
You should exit the procedure too. Look at this:
--- Quote ---var running:boolean;
implementation
{ TForm1 }
procedure lengthy;
begin
while true do //forever
begin
Application.ProcessMessages;
if not running then break;
sleep(50);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
running:=true;
lengthy;
end;
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: boolean);
begin
running:=false;
end;
--- End quote ---
Waco:
Thank you very much. That's exactly what I was looking for, especially the CloseQuery, I didn't know about that.
Navigation
[0] Message Index
[*] Previous page