Delphi FMX TIdHTTP onWork, onWorkBegin, onWorkEnd not working

  

I’ve been fighting with TIdHTTP and Delphi FMX for a while and I don’t get good results, so, I don’t really know what to do.
So, the thing that I want to do is to show a ProgressBar while GETTING and POSTING with TIdHTTP. I’ve seen some codes online, that I’ve adapted, but nothing works.
But the problem is not only that the ProgressBar doesn’t work. The problem goes much further:
I tried to make an easier functionality, that only makes Visible:= true and Visible:= false when the IdHTTP is working.
So, I thought: If I make a get or a post, the TIdHTTP events OnWorkBegin, OnWork and OnWorkEnd should capture the action and make it visible/invisible.
So, the code I put was that:
procedure TF_FTP.IdFTP1WorkBegin(ASender: TObject; AWorkMode: TWorkMode; AWorkCountMax: Int64);
begin
ProgressBar1.Visible := true;
end;

procedure TF_FTP.IdFTP1Work(ASender: TObject; AWorkMode: TWorkMode;
AWorkCount: Int64);
begin
ProgressBar1.Visible := true;
end;

and
procedure TF_FTP.IdFTP1WorkEnd(ASender: TObject; AWorkMode: TWorkMode);
begin
ProgressBar1.Visible := false;
end;

What happened is, at the first get, the ProgressBar was visible because in the Form Design it is set as Visible. When it finishes, the ProgressBar gets invisible. Ok, well. But when I try to make another get or post, the ProgressBar never appears again.
If I make the ProgressBar invisible at the Form design, it never shows up.
I tried putting the Visible/Invisible on other IdHTTP events, as onConnected-onDisconnected, onBeforeGet-onAfterGet, … nothing seems to work. In addition, when I’m downloading the files, the Form freezes.
I don’t know what is happening, I’m running on Android64.
Thank you in advance.

Comments are closed.