Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Mouse scroll anomaly

Have been shown an instance where the mouse scroll doesn't work as expected for a specific tree control.
Other tree controls in the same application, scroll as expected. For the one user, (that we know about), one control only scrolls if a child item is selected.
For me, that control works like all others in the application, has focus will scroll.
For this user, the other controls also scroll if they have focus but just this one control requires you to expand an item and select one of the children before the mouse scroll kicks in.

It's just one of our developer tools so it's not critical but I can't replicate it personally so I can't really troubleshoot. Was simply wondering if anybody had any ideas on this peculiarity.

Comments

  • Can you see the vertical scroll bar before an item is expanded? My WM_MOUSEWHEEL message handler only scrolls if the Tree control has the WS_VSCROLL style bit (and isn't disabled).

    if( IsWindowEnabled() && (GetStyle() & WS_VSCROLL) ) { if( numToScroll > 0 ) OnVScroll( SB_LINEDOWN, 0, NULL ); else if( numToScroll < 0 ) OnVScroll( SB_LINEUP, 0, NULL ); }

    I wonder if that bit is missing even though the it's rendered in the tree. I haven't really come across this in the wild, though, so it's a shot in the dark.

    WM_MOUSEWHEEL is a message that Windows automatically sends to any control with focus. So, the only other points of failure here are the tree not getting focus or something else eating the WM_MOUSEWHEEL message. I can tell you that the first line of code on every mouse click in the Tree Control code is to set focus, no matter what you're doing. So, clicking anywhere on the control should give it focus. As another test, try using keyboard navigation. Does it work right away or only when an item is expanded?
  • There is a scrollbar before expanding.
    Keyboard navigation is displaying the same symptoms as the mousewheel.
    This is what the control looks like and for me, I only need hover over it to scroll. Never even need click.

    The offending control/system needs this to happen before either mousewheel or keyboard will scroll

  • The fact that keyboard commands don't work tells me that the control is not getting focus for some reason. Perhaps you can try to force focus when the form finishes loading?
  • Have just done that but then realised it's not a good reference point. The keyboard navigation doesn't work exactly the same anyway because if we select a top level item, we set focus to a different control on the window so the keyboard navigation won't work anyway. The mousewheel still does for me though.
    So for me, the mousewheel works as long as you hover over the tree, regardless of which control on the form has focus. The keyboard works only if the tree has focus and a child item is selected.

    Basically, I dont' think my original answer was correct. It seemed the same but there was a genuine reason why the keyboard worked the way it did.
Sign In or Register to comment.