cause i dont want that other forms are opened, i want just to stop the process, work with some other procedures and then by cliking resume work with the stoped procedure again
but this codes dont stopes on Suspend, but counts directly up to 3
Delphi-Quellcode:
type TFiber=class(TTHread)
Memo:TMemo;
procedure execute; override;
procedure doit;
constructor Create(iMemo:TMemo);
end;
constructor TFiber.Create(iMemo:TMemo);
begin
inherited Create(false);
Memo:=iMemo;
end;
procedure TFiber.execute;
var i:integer;
begin
Synchronize(Doit);
doit;
end;
procedure TFiber.doit;
var i:integer;
begin
i:=0;
repeat
Memo.Lines.Append(IntToStr(i));
Suspend;
i:=i+1;
until i=3;
end;
var Fiber:TFiber;
procedure TForm1.Button1Click(Sender: TObject);
var i:integer;
begin
Fiber:=TFiber.Create(Memo1);
Fiber.execute;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Fiber.Resume;
end;