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