Re: [Lazarus] Progressbar never reaches the end
On Thu, Jan 25, 2018 at 7:27 PM, frans via Lazarus 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 -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Progressbar never reaches the end
Thx Bart for the reply. But where stands Value for? I tried a recordcounter, but that was even worse. mvg Frans van Leeuwen M 06-51695390 Op 25-1-2018 om 19:36 schreef Bart via Lazarus: On Thu, Jan 25, 2018 at 7:27 PM, frans via Lazarus 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 --- Deze e-mail is gecontroleerd op virussen door AVG. http://www.avg.com -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Progressbar never reaches the end
Hi Bart. Forget my previous mail, I placed the Increment command in teh wrong loop. Now, in the right loop, it makes a small better difference. Thx. mvg Frans van Leeuwen M 06-51695390 Op 25-1-2018 om 19:36 schreef Bart via Lazarus: On Thu, Jan 25, 2018 at 7:27 PM, frans via Lazarus 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 --- Deze e-mail is gecontroleerd op virussen door AVG. http://www.avg.com -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Progressbar never reaches the end
On Fri, Jan 26, 2018 at 11:52 AM, frans via Lazarus wrote: > Now, in the right loop, it makes a small better difference. Or try something like this: http://svn.code.sf.net/p/flyingsheep/code/trunk/MijnLib/fsiprogbar.pp I wrote that, just because of the annoying behaviour of the default progressbar on Win Vista and up. Bart -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus