TAdvProgressBar is not updated

The TAdvProgressBar is not filling up when I increase its position. Here is an example. I have a form which has TAdvProgressBar *Pb and TButton *Button1. The latter has an OnClick method Button1Click as follows:

void __fastcall TForm1::Button1Click(TObject *Sender)
{
unsigned i_max = 1000;
Pb->Max = i_max;
Pb->Position = 0;
for (unsigned i = 1; i <= i_max; i++)
{
Pb->Position++;
Sleep(1);
}
}

When clicking Button1, the progress bar is not filling up gradually, but stays at 0%. Only after completing the for-loop the 100% fill is shown.

What do I have to do to see a gradually filled up progress bar?

I am using VCL UI Pack 10.6.1.0

This is expected. In this loop, you are not allowing the Windows message loop to work and hereby blocking UI updates.
Call in this loop Application->ProcessMessages();

Adding a line Application->ProcessMessages(); makes it even worse: The bar is still not filling up, but now also not after completing the for-loop.

If I replace the TAdvProgressBar *Pb by a TProgressBar *Pb it works fine: the bar is filling up gradually.

I could not reproduce this here.
Even without calling Application.ProcessMessages it works here.

Test with a default TAdvProgressaBar on the form:

procedure TForm1.Button1Click(Sender: TObject);
var
  i: integer;
begin
  for i := 0 to 100 do
  begin
    AdvProgressBar1.Position := i;
    sleep(10);
//    application.ProcessMessages;  // works with or without
  end;
end;

This visually updates the progressbar during the loop
advprogressbar

Bruno,

Your example works here as well. But when I change the loopsize from 100 to 1000 it fails. Can you give that a try?
P.S. I have set the max of the ProgressBar to the value of the loopsize.

Test code:
procedure TForm1.Button1Click(Sender: TObject);

var
  i: integer;
begin
    AdvProgressBar1.Max := 1000;
  for i := 0 to 1000 do
  begin
    AdvProgressBar1.Position := i;
    sleep(10);
    button1.Caption := i.ToString;
//    application.ProcessMessages;  // works with or without
  end;

end;

advprogressbar2

When I add a line AdvProgressBar1->Refresh(); it works well, but without that line (at a loopsize of 1000) I see no fill.
Can it be explained by the fact that I am using C++?
Is there a property that sets an automatic refresh?
Is there a global or project option that plays a role?
Can it be explained by the TMS-version (10.6.1.0 in my case)?

Can it be you still have some old version files around?
I could see the issue with an older version but after ensuring the latest version files were used in C++Builder, I cannot longer reproduce a problem.

Bruno,

I have installed the latest version (10.6.2.0) of TMS VCL UI Pack. Now it works fine again. Thanks for your help.