[Lazarus] Progressbar never reaches the end
Bart
bartjunk64 at gmail.com
Thu Jan 25 19:36:15 CET 2018
On Thu, Jan 25, 2018 at 7:27 PM, frans via Lazarus
<lazarus at lists.lazarus-ide.org> wrote:
> The
> progressbar functions fine but when position=max, the progressbar visualy
> never reaches the end.
Thank Uncle Bill for that.
The progressbar animates to the position you set it to.
This takes time.
If you do ProgressBar1.Position := ProgressBar1.Max and the
(physically) wait a while, it will get to full 100%.
The trick to get an immediate update is to decrement the position: no
animation, no waiting time.
Unfortunately this cannot be done for the 100% value.
I have some code in one of my apps like this to get rid of the animation:
{$ifdef windows}
if Value > 0 then
begin
//trick modern Windows to draw the position at once, otherwise you
never see the 100%
ProgressBar.Position := Value - 1;
ProgressBar.Repaint;
ProgressBar.Position := Value;
ProgressBar.Repaint;
end;
{$endif}
If it bothers you, there are plenty of customdrawn progressbars out
there (or switch of themes, to get the old behaviour back).
Bart
More information about the Lazarus
mailing list