Running long tasks in a background thread to keep the UI responsive is one of the main purposes of multithreading. A common code pattern for doing so would look like:
procedure TMainForm.BtnClick(Sender: TObject);
begin
TThread.CreateAnonymousThread(
procedure
begin
DoSomeWork;
end;
end).Start;
end;
However, such code often needs to show the results of that long work to the user. W
Weiterlesen...