Registriert seit: 18. Nov 2015
Ort: Kehl
678 Beiträge
Delphi 11 Alexandria
|
AW: Thread soll die richtige LForm finden.
9. Mai 2016, 20:23
also sowas wie:
Delphi-Quellcode:
tmyresult = procedure(const aList : TStrings) of object;
TmyThread = class(TThread)
private
fresultproc : tmyresultproc;
public
constructor Create(const aresultproc : tmyresult);
procedure ResultThread;
procedure execute ; override;
end;
constructor TmyThread.Create(const aresultproc : tmyresult);
begin
inherited Create(false);
fresultproc := aresultproc;
end;
procedure TmyThread.execute ;
begin
while not terminated do
begin
// tu was
end;
synchronize(ResultThread);
end;
procedure TmyThread.ResultThread;
begin
if assigned(fresultproc) then
fresultproc(FResultstringlist);
end;
Delphi-Quellcode:
// in Form
procedure tmyform.resultThread(const aList : TStrings);
begin
//tue was mit alist
end;
//Aufrufen mit :
TmyThread.create(myForm.resultThread);
Fritz Westermann
|
|
Zitat
|