Wenn man sich nicht schämt das direkt auf dem Formular zu machen:
Delphi-Quellcode:
unit GUI.MainForm;
interface uses
System.SysUtils,
System.Classes,
System.Threading,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
Vcl.StdCtrls;
type
TMainForm =
class(TForm)
Button1: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
private var
myTask: ITask;
waitingForm: TForm;
private
procedure someWork();
procedure signalCompletion();
end;
var
MainForm: TMainForm;
implementation
{$R *.dfm}
procedure TMainForm.Button1Click(Sender: TObject);
begin
myTask := TTask.Run(someWork);
waitingForm := TForm.Create(self);
waitingForm.ShowModal();
end;
procedure TMainForm.signalCompletion();
begin
waitingForm.ModalResult := mrClose;
end;
procedure TMainForm.someWork();
begin
TThread.Sleep(2000);
TThread.Queue(TThread.Current, signalCompletion);
end;
end.
PS: Freigabe des Popups nicht vergessen.