Sign in to follow this  
Followers 0
qwert

[Solved] How to activate scroll wheel for scrollable graphic?

3 posts in this topic

#1 ·  Posted (edited)

I use a child GUI to display a graphic that often exceeds the height of that control, so I've defined a vertical scroll bar. Everything about the scroll bar works fine -- except that the graphic doesn't scroll when I try to use the mouse scroll wheel. (The wheel works fine with all other applications.)

I've searched with no success for anything to indicate that a separate "enable scroll wheel" step is needed. These are the WM_VSCROLL entries I have defined:

Switch $nScrollCode
        Case $SB_TOP ; user clicked the HOME keyboard key
            DllStructSetData($tSCROLLINFO, "nPos", $Min)

        Case $SB_BOTTOM ; user clicked the END keyboard key
            DllStructSetData($tSCROLLINFO, "nPos", $Max)

        Case $SB_LINEUP ; user clicked the top arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)

        Case $SB_LINEDOWN ; user clicked the bottom arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)

        Case $SB_PAGEUP ; user clicked the scroll bar shaft above the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)

        Case $SB_PAGEDOWN ; user clicked the scroll bar shaft below the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)

        Case $SB_THUMBTRACK ; user dragged the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
    EndSwitch

I will appreciate a nudge in the right direction.

Thanks.

Edited by qwert

Share this post


Link to post
Share on other sites



Excellent reference. Thank you.

Just to clarify for others, the technique is to register a separate function to detect a scroll wheel movement ... and then send a message to the (previously-defined) WM_VSCROLL function to invoke an up or down shift:

GUIRegisterMsg($WM_MOUSEWHEEL, 'WM_MOUSEWHEEL')
;
;
Func WM_MOUSEWHEEL($hWnd, $iMsg, $iwParam, $ilParam)
    Local $iDelta = BitShift($iwParam, 16)
    If $iDelta > 0 Then
        _SendMessage($GUI, $WM_VSCROLL, $SB_LINEUP)
    Else
        _SendMessage($GUI, $WM_VSCROLL, $SB_LINEDOWN)
    EndIf
    Return 'GUI_RUNDEFMSG'
EndFunc

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0