Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Determine if DataGrid is in Edition Mode?

Status
Not open for further replies.

todd666

IS-IT--Management
Dec 3, 2001
61
CA
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:

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]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top