Slider not working properly.?
-
Hi, I have a slider control on a dialog box. I am playing a video file and slider moves according to the video elapsed. Suppose I have set the slider range to 100. Now till some point say 90, the slider moves to the point wherever I click the mouse. but at the last point in between some range say 90 - 100 (to the end of the slider), if I click the mouse button anywhere, slider jumps to the end. I am using a TimeLine control where user can add more than 1 video (1, 2, 4, 8, 10 , 50 etc......), If I use only one video, slider moves as per the video progression.....Issue arises when I add more than 1 video and click on the start button, slider starts moving....Now when I drag the slider to any position or I click the mouse button anywhere on the slider control, slider thumb moves to that position and immediately jumps back to some other position. This is the Issue, I am facing. Can anybody share some sample code where slider is moving with the video showing the progress of the video. I want to implement a functionality similar to VLC player. Wherever user clicks the mouse, slider moves to that point. Any help will be appreciated. Regards, Mbatra
-
Hi, I have a slider control on a dialog box. I am playing a video file and slider moves according to the video elapsed. Suppose I have set the slider range to 100. Now till some point say 90, the slider moves to the point wherever I click the mouse. but at the last point in between some range say 90 - 100 (to the end of the slider), if I click the mouse button anywhere, slider jumps to the end. I am using a TimeLine control where user can add more than 1 video (1, 2, 4, 8, 10 , 50 etc......), If I use only one video, slider moves as per the video progression.....Issue arises when I add more than 1 video and click on the start button, slider starts moving....Now when I drag the slider to any position or I click the mouse button anywhere on the slider control, slider thumb moves to that position and immediately jumps back to some other position. This is the Issue, I am facing. Can anybody share some sample code where slider is moving with the video showing the progress of the video. I want to implement a functionality similar to VLC player. Wherever user clicks the mouse, slider moves to that point. Any help will be appreciated. Regards, Mbatra
Derive you own class from CSliderCtrl and handle the left button down (I have no merit, this is from a simple google search)
void MySlider::OnLButtonDown(UINT nFlags, CPoint point)
{
CSliderCtrl::OnLButtonDown(nFlags, point);
CRect rectClient, rectChannel;
GetClientRect(rectClient);
GetChannelRect(rectChannel);
int nPos = (GetRangeMax() - GetRangeMin())*(point.x - rectClient.left - rectChannel.left) / (rectChannel.right - rectChannel.left);
SetPos(nPos);
}Nihil obstat
-
Derive you own class from CSliderCtrl and handle the left button down (I have no merit, this is from a simple google search)
void MySlider::OnLButtonDown(UINT nFlags, CPoint point)
{
CSliderCtrl::OnLButtonDown(nFlags, point);
CRect rectClient, rectChannel;
GetClientRect(rectClient);
GetChannelRect(rectChannel);
int nPos = (GetRangeMax() - GetRangeMin())*(point.x - rectClient.left - rectChannel.left) / (rectChannel.right - rectChannel.left);
SetPos(nPos);
}Nihil obstat
I have done this...its working .... Please read below: Hi, I have a slider control on a dialog box. I am playing a video file and slider moves according to the video elapsed. Suppose I have set the slider range to 100. Now till some point say 90, the slider moves to the point wherever I click the mouse. but at the last point in between some range say 90 - 100 (to the end of the slider), if I click the mouse button anywhere, slider jumps to the end. I am using a TimeLine control where user can add more than 1 video (1, 2, 4, 8, 10 , 50 etc......), If I use only one video, slider moves as per the video progression.....Issue arises when I add more than 1 video and click on the start button, slider starts moving....Now when I drag the slider to any position or I click the mouse button anywhere on the slider control, slider thumb moves to that position and immediately jumps back to some other position. This is the Issue, I am facing. Can anybody share some sample code where slider is moving with the video showing the progress of the video. I want to implement a functionality similar to VLC player. Wherever user clicks the mouse, slider moves to that point. Any help will be appreciated. Regards, Mbatra