[Lazarus] TProgressbar moves slowly, is there a hidden setting for faster response?
Bo Berglund
bo.berglund at gmail.com
Wed May 15 17:28:58 CEST 2019
On Wed, 15 May 2019 17:13:48 +0200, Ondrej Pokorny via lazarus
<lazarus at lists.lazarus-ide.org> wrote:
>> I really do not want to create a panel child to implement this
>> behaviour unless I am really forced to....
>
>That's what I would do. (But not a panel child but a TGraphicControl
>descendant.)
After thinking a bit on the difference between going forwards and
backwards, I did this test:
MouseUp event used to reposition the video playing pos:
procedure TfrmMain.pgbProgressMouseUp(Sender: TObject; Button:
TMouseButton; Shift: TShiftState; X, Y: Integer);
{Progressbar set to seconds resolution rather than milisec}
var
Pos: double;
begin
Pos := double(X) / pgbProgress.Width * (pgbProgress.Max -
pgbProgress.Min);
vlcPlayer.SetVideoPosInMs(Round(Pos) * 1000);
end;
The player's TimeChanged event updates the progress bar:
procedure TfrmMain.vlcPlayerMediaPlayerTimeChanged(Sender: TObject;
time: Int64);
var
P: int64;
begin
P := vlcPlayer.GetVideoPosInMs();
P := P div 1000; //Progressbar is in sec rather than ms
pgbProgress.Position := P + 1;
pgbProgress.Position := P ;
end;
end;
Notice that I am now first setting the position 1 higher than
requested and then immediately backing down by 1.
AND IT WORKS!!!!!
Now the progress bar immediately jumps to the wanted position without
the "smooth scroll" that MS implemented!
--
Bo Berglund
Developer in Sweden
More information about the lazarus
mailing list