I get this error
Quote:
| [dcc32 Error] project.pas(949): E2009 Incompatible types: 'Parameter lists differ' |
when I try to call WorkBegin and Work
procedure Tform2.DownloadTable;
var
ms: TMemoryStream;
path :string;
begin
ms := TMemoryStream.Create;
path := DIR; //global variable
try
with IdHttp1 do
IdHTTP1.Get(URLTAB, ms);
ms.Position := 0;
SetCurrentDir(path);
ms.SaveToFile('table.rar');
IdHttp1.OnWorkBegin := WorkBegin;
IdHttp1.OnWork := Work;
finally
ms.Free;
end;
end;
procedure TForm2.WorkBegin(ASender: TObject; AWorkMode: TWorkMode;
const AWorkCountMax: Int64);
begin
ProgressBar2.Max := AWorkCountMax;
end;
procedure TForm2.Work(ASender: TObject; AWorkMode: TWorkMode;
const AWorkCount: Int64);
begin
ProgressBar2.Position := AWorkCount;
end;
Maybe I found the errors. The exact code should be:
procedure Tform2.DownloadTable;
var
ms: TMemoryStream;
path :string;
begin
ms := TMemoryStream.Create;
path := DIR; //global variable
try
with IdHttp1 do
begin
Get(URLTAB, ms);
ms.Position := 0;
SetCurrentDir(path);
ms.SaveToFile('table.rar');
OnWorkBegin := WorkBegin;
OnWork := Work;
end;
finally
ms.Free;
end;
end;
procedure TForm2.WorkBegin(ASender: TObject; AWorkMode: TWorkMode; AWorkCountMax: Int64);
begin
ProgressBar2.Max := AWorkCountMax;
end;
procedure TForm2.Work(ASender: TObject; AWorkMode: TWorkMode; AWorkCount: Int64);
begin
ProgressBar2.Position := AWorkCount;
end;
I can compile the exe but I stil have a problem: I can see download progress only the second time i push on the button.