Hi,
I use a DataGrid and when the cursor of my mouse is on datagrid, I can use the mouse wheel on it and it works very well. The problem is when I click on the DataGrid (for example), the DataGrid becomes in "Edition Mode" and the mouse wheel don't work. I have to press "Escape" and after I can use the mouse wheel again.
What I want to do is that the user don't have to press "Esc" to use the wheel in this situation.
So I try to determine when the DataGrid is in "Edition Mode" and turn this mode OFF but it don't work. Even if I set the properties "Form1.DataGrid1.EditActive = False", the DataGrid is always in "Edition Mode".
Can someone help me? Here is a part of my code:
I use a DataGrid and when the cursor of my mouse is on datagrid, I can use the mouse wheel on it and it works very well. The problem is when I click on the DataGrid (for example), the DataGrid becomes in "Edition Mode" and the mouse wheel don't work. I have to press "Escape" and after I can use the mouse wheel again.
What I want to do is that the user don't have to press "Esc" to use the wheel in this situation.
So I try to determine when the DataGrid is in "Edition Mode" and turn this mode OFF but it don't work. Even if I set the properties "Form1.DataGrid1.EditActive = False", the DataGrid is always in "Edition Mode".
Can someone help me? Here is a part of my code:
Code:
Sub MouseWheel(Travel As Integer, X As Long, Y As Long)
Dim hWndGrid As Long, hWndScroll As Long
hWndGrid = Form1.DataGrid1.hwnd
If WindowFromPoint(X, Y) = hWndGrid Then
If Travel < 0 Then Travel = 1 Else Travel = 0 'The scroll code (up/down)
hWndScroll = FindWindowEx(hWndGrid, 0, "ScrollBar", "DataGridSplitVScroll")
'I change the mode of DataGrid, it doesn't work.
Form1.DataGrid1.EditActive = False '<-- turn off edit mode
'I try to send the "ESCAPE" KEY, it doesn't work.
SendKeys "{ESC}", True
SendMessage hWndGrid, WM_VSCROLL, Travel, ByVal hWndScroll
End If
End Sub
[\code]