[Lazarus] TProgressbar moves slowly, is there a hidden setting for faster response?

Sven Barth pascaldragon at googlemail.com
Wed May 15 17:20:04 CEST 2019


Bo Berglund via lazarus <lazarus at lists.lazarus-ide.org> schrieb am Mi., 15.
Mai 2019, 17:11:

> On Wed, 15 May 2019 13:38:19 +0200, Ondrej Pokorny via lazarus
> <lazarus at lists.lazarus-ide.org> wrote:
>
> >Because WinAPI developers wanted it so - the drawing of TProgressBar is
> >fully in charge of the OS.
>
> Strangely just discovered that the progressbar is painted "fast
> enough" if I click a position towards the lower side of the current
> position!
>
> So start and click towards the end (max) - it slowly paints the bar.
> Then click towards the start (min) - it *immediately* paints it
> correctly.
>
> There *must* be a way to enforce the latter paint method also for
> positive moves....
>
> I really do not want to create a panel child to implement this
> behaviour unless I am really forced to....
>

One possible workaround I found (not tested) is this:

=== code begin ===

YourProgressbar.Position := YourTarget;
YourProgressbar.Position := Your Target - 1;
YourProgressbar.Position := YourTarget;

=== code end ===

You first tell the progress bar your new desired target value (which
triggers a slow animation), then you go one step back (which will enforce a
fast redraw) and then to the target again (which again will be a slow
animation, but shouldn't be that slow with only one point difference).

Note: I currently don't know whether the property on TProgressBar is
Position or Value. It's been a while since I last used one ;)

Note 2: you can put similar code into the click handler, though there
without the first step probably.

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20190515/f0d03071/attachment.html>


More information about the lazarus mailing list