NFordtektips
Programmer
thread222-902639
I have a Visual Basic 6 project with 4 DataGrids which I want to be able to scroll with a mouse wheel. The DataGrid does not support this, so I am using the code from the thread referenced above, but as written, only one DataGrid can be set to scroll using:
I tried using the DataGrid's .MouseMove event to change the above to whichever grid the mouse was over:
and in the scrolling code from the previous thread, used
but when run, VB6 gave me an "Out of stack space" error because the following routine keeps looping:
Thanks for any help.
I have a Visual Basic 6 project with 4 DataGrids which I want to be able to scroll with a mouse wheel. The DataGrid does not support this, so I am using the code from the thread referenced above, but as written, only one DataGrid can be set to scroll using:
Code:
lpPrevWndProc = SetWindowLong(Grid1(0).hWnd, GWL_WNDPROC, AddressOf WndProc)
I tried using the DataGrid's .MouseMove event to change the above to whichever grid the mouse was over:
Code:
If int_MouseOverGrid <> Index Then
int_MouseOverGrid = Index
lpPrevWndProc = SetWindowLong(Grid1(Index).hWnd, GWL_WNDPROC, AddressOf WndProc)
End If
and in the scrolling code from the previous thread, used
Code:
Sub MouseWheel(Travel As Integer, X As Long, Y As Long)
BBEditor.Grid1(int_MouseOverGrid).Scroll 0, -Travel * 3
End Sub
Code:
Function WndProc(ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
If Msg = WM_MOUSEWHEEL Then
Dim Delta As Long
Static Travel As Long
Delta = HiWord(wParam)
Travel = Travel + Delta
MouseWheel Travel \ WHEEL_DELTA, LoWord(lParam), HiWord(lParam)
Travel = Travel Mod WHEEL_DELTA
End If
WndProc = CallWindowProc(lpPrevWndProc, hWnd, Msg, wParam, lParam)
End Function
Thanks for any help.