IdHTTP.Post - 我无法在进度栏中显示进度

发布于 2024-11-19 00:58:43 字数 492 浏览 2 评论 0原文

我正在尝试显示来自 TIdHTTP 组件的 POST 调用的进度。

procedure TForm1.IdHTTP1Work(ASender: TObject; AWorkMode: TWorkMode;
  AWorkCount: Int64);
begin
ProgressBar1.Position := AWorkCount;
end;

procedure TForm1.IdHTTP1WorkBegin(ASender: TObject; AWorkMode: TWorkMode;
  AWorkCountMax: Int64);
begin
Progressbar1.Max := AWorkCountMax;
end;

然而,当我调试这个时,我在 .Max = AWorkCountMax; 行上登陆了两次,第一次该值是 65,第二次该值是 0。

我知道它可能不是必要的,因为它并不需要很长时间,但完全取决于返回的数据量,它可能需要很长时间。

I am trying to display the progress of a POST call from my TIdHTTP component.

procedure TForm1.IdHTTP1Work(ASender: TObject; AWorkMode: TWorkMode;
  AWorkCount: Int64);
begin
ProgressBar1.Position := AWorkCount;
end;

procedure TForm1.IdHTTP1WorkBegin(ASender: TObject; AWorkMode: TWorkMode;
  AWorkCountMax: Int64);
begin
Progressbar1.Max := AWorkCountMax;
end;

However when I debug this, I land 2 times on the .Max = AWorkCountMax; line, and the first time the value is 65, and the 2nd time the value is 0.

I know it might not be necessary, since it doesent take long, but all depending on how much data is being returned, it can take long.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烟雨凡馨 2024-11-26 00:58:43

开始

procedure TForm1.IdHTTPWorkBegin(Sender: TObject; AWorkMode: TWorkMode;
  const AWorkCountMax: Integer);
begin
   if AWorkMode = wmRead then 
   begin
      ProgressBar.Max := AWorkCountMax; 
      ProgressBar.Position := 0; 
   end;
end;

传输

procedure TForm1.IdHTTPWork(Sender: TObject; AWorkMode: TWorkMode;
  const AWorkCount: Integer);
begin
   if AWorkMode=wmRead then 
     ProgressBar.Position := AWorkCount;
end;

结束

procedure TForm1.IdHTTPWorkEnd(Sender: TObject; AWorkMode: TWorkMode);
begin
  ProgressBar.Position := 0;
end;

begin

procedure TForm1.IdHTTPWorkBegin(Sender: TObject; AWorkMode: TWorkMode;
  const AWorkCountMax: Integer);
begin
   if AWorkMode = wmRead then 
   begin
      ProgressBar.Max := AWorkCountMax; 
      ProgressBar.Position := 0; 
   end;
end;

tranfert

procedure TForm1.IdHTTPWork(Sender: TObject; AWorkMode: TWorkMode;
  const AWorkCount: Integer);
begin
   if AWorkMode=wmRead then 
     ProgressBar.Position := AWorkCount;
end;

end

procedure TForm1.IdHTTPWorkEnd(Sender: TObject; AWorkMode: TWorkMode);
begin
  ProgressBar.Position := 0;
end;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文