[Lazarus] TTrackBar alternative allowing slider move by clicking the bar?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[Lazarus] TTrackBar alternative allowing slider move by clicking the bar?

Free Pascal - Lazarus mailing list
I am navigating a video using a TTrackBar component using an example
from a blogpost. It works well to drag the handle and reposition the
video when the handle is released.

But I cannot for the life of me figure out how to set the handle
position by clicking on the bar *outside* of the handle....
I.e. reposition by click rather than drag. (I want both possibilities)
It seems like the handle moves a certain fixed distance on each click
irrespective of where on the control the click is done.

Typical video players allow grabbing the handle and sliding it to a
new position *as well as* clicking on the bar outside of the handle to
move the handle over *to that point*. The handle should move to the
mouse pointer position, not using some unspecified increment.
It seems like this is not possible with TTrackBar. :-(

So is there an alternate TTrackBar available or any other position
indicator that can be used to allow repositioning via a click?
Or some code to add to change its behaviour?

If I could get the value at the click point I could use the OnClick
event to reposition it in code, but it seems like the X/Y values are
pixel positions rather than actual trackbar pÄosition values.
Note: The max value will be set by the length of the video in
milliseconds when the video is loaded, so it is a quite large value...

Bo Berglund
Developer in Sweden

lazarus mailing list
[hidden email]