I am making a basic music player and am using a TTrackBar as the progress in the song. As well I want to make it so u can drag the bar and fast forward the song.
Currently I have an OnChange event with the following line:
MediaPlayer1.position := TrackBar1.value... (with proper casting)
but what happens is that it skips the song along as I drag making a choppy sound as it plays the song at certain random points along the way.
What I really want is for when the user stops dragging the song should change. What event is this? The onStopDrop even doesn't do the trick..
The scroll notification messages arrive though
WM_HSCROLL
orWM_VSCROLL
, depending on the orientation of your track bar. These surface in the VCL control asCN_HSCROLL
andCN_VSCROLL
. You need to handle these messages and ignore message for which the scroll code isTB_THUMBTRACK
to prevent the control to fire theOnChange
event when the user drags the slider.For example, here is an interposer control that does what you need: