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. Mouse event pecularity in vertical scrollbar

Mouse event pecularity in vertical scrollbar

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
6 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.
  • V Offline
    V Offline
    Vancouver
    wrote on last edited by
    #1

    I have a static control with horizontal and vertical scrollbars. Both scrollbars are enabled and effective (i.e. there is scrolling amount), working fine. The static control is a subclass of CStatic. I am monitoring the mouse actions in this static control with OnLButtonUp, OnLButtonDown, OnRButtonUp, OnRbuttonDown and OnMouseMove. Additionally, there is an OnMouseMove in the parent window of the static control (which is the dialog). This monitors if the mouse leaves the rectangle of the static control. Everything works fine, EXCEPT when the mouse moves from the static control over the vertical scroll bar rectangle, this will not be reported to the parent's OnMouseMove However, there is no problem with the horizontal scroll bar, and if the vertical scrollbar is disabled, then the mouse move will be reported. What can be the reason to this behaviour?

    M 1 Reply Last reply
    0
    • V Vancouver

      I have a static control with horizontal and vertical scrollbars. Both scrollbars are enabled and effective (i.e. there is scrolling amount), working fine. The static control is a subclass of CStatic. I am monitoring the mouse actions in this static control with OnLButtonUp, OnLButtonDown, OnRButtonUp, OnRbuttonDown and OnMouseMove. Additionally, there is an OnMouseMove in the parent window of the static control (which is the dialog). This monitors if the mouse leaves the rectangle of the static control. Everything works fine, EXCEPT when the mouse moves from the static control over the vertical scroll bar rectangle, this will not be reported to the parent's OnMouseMove However, there is no problem with the horizontal scroll bar, and if the vertical scrollbar is disabled, then the mouse move will be reported. What can be the reason to this behaviour?

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      That sounds strange. If the scrollbars are standard scrollbars (not controls) then they are part of the non-client area of the static control. I would expect the wParam of a WM_NCMOUSEMOVE message in the static control then would be HTHSCROLL/HTVSCROLL. *edit* I guess I should clarify - what sounds strange to me is that the parent would get a mousemove message when the cursor is on the scrollbar of a child window... -- modified at 16:15 Thursday 14th June, 2007

      "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

      V 1 Reply Last reply
      0
      • M Mark Salsbery

        That sounds strange. If the scrollbars are standard scrollbars (not controls) then they are part of the non-client area of the static control. I would expect the wParam of a WM_NCMOUSEMOVE message in the static control then would be HTHSCROLL/HTVSCROLL. *edit* I guess I should clarify - what sounds strange to me is that the parent would get a mousemove message when the cursor is on the scrollbar of a child window... -- modified at 16:15 Thursday 14th June, 2007

        "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

        V Offline
        V Offline
        Vancouver
        wrote on last edited by
        #3

        The scroll bars are separate controls. I'm sorry, I did not mention this, because I thought the fact that the mouse movement over the horizontal scroll bar will be reported makes this clear.

        M 1 Reply Last reply
        0
        • V Vancouver

          The scroll bars are separate controls. I'm sorry, I did not mention this, because I thought the fact that the mouse movement over the horizontal scroll bar will be reported makes this clear.

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          In that case, it still sounds strange. I would expect the mousemove messages to go to the scrollbar controls, not the parent :confused: Are the scrollbars children of the dialog or the static control? Mark

          "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

          V 1 Reply Last reply
          0
          • M Mark Salsbery

            In that case, it still sounds strange. I would expect the mousemove messages to go to the scrollbar controls, not the parent :confused: Are the scrollbars children of the dialog or the static control? Mark

            "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

            V Offline
            V Offline
            Vancouver
            wrote on last edited by
            #5

            The scrollbars are children of the dialog.

            M 1 Reply Last reply
            0
            • V Vancouver

              The scrollbars are children of the dialog.

              M Offline
              M Offline
              Mark Salsbery
              wrote on last edited by
              #6

              I can't see where the behavior would be different between the scroll bars. WM_MOUSEMOVE messages go to the window under the cursor. If the cursor is over a scrollbar control then the messages should go to that control. Mark

              "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

              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