I can't seem to find a way to use a key press or button2 click to break out of a loop in the following code example.
If it is possible, any help will be appreciated.
procedure TForm1Button1Click(Sender:TObject);
begin
while (xxxxx) do
begin
// code
// at this point detect key press or button click to break out of loop before it is finished
end;
end;