Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Slider not working properly.?

Slider not working properly.?

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mbatra31
    wrote on last edited by
    #1

    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

    M 1 Reply Last reply
    0
    • M mbatra31

      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

      M Offline
      M Offline
      Maximilien
      wrote on last edited by
      #2

      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

      M 1 Reply Last reply
      0
      • M Maximilien

        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

        M Offline
        M Offline
        mbatra31
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups