Catching OnMouseMove on CGridCtrl
-
I have an SDI app (test app), where I spread an CGridCtrl ... I wonder how to catch
CMyView::OnMouseMove
, because I saw that this handler is never fired ... can you help me, please ? -
I try that:
void CGridViewDemoView::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
TRACE("aaaaaaaaaaaaaaaaaaaaaaaaaa\n");
CView::OnMouseMove(nFlags, point);
}Taked from here.
You probably forgot to add the corresponding entry to your message map:
BEGIN_MESSAGE_MAP(CGridViewDemoView, CView)
ON_WM_MOUSEMOVE()
END_MESSAGE_MAP() -
You probably forgot to add the corresponding entry to your message map:
BEGIN_MESSAGE_MAP(CGridViewDemoView, CView)
ON_WM_MOUSEMOVE()
END_MESSAGE_MAP()I did that:
BEGIN_MESSAGE_MAP(CGridViewDemoView, CView)
//{{AFX_MSG_MAP(CGridViewDemoView)
ON_WM_SIZE()
ON_COMMAND(ID_TOGGLE_READONLY, OnToggleReadonly)
ON_WM_ERASEBKGND()
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP() -
I did that:
BEGIN_MESSAGE_MAP(CGridViewDemoView, CView)
//{{AFX_MSG_MAP(CGridViewDemoView)
ON_WM_SIZE()
ON_COMMAND(ID_TOGGLE_READONLY, OnToggleReadonly)
ON_WM_ERASEBKGND()
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()Then there are two other possible sources:
- The message is handled by a window that is over your view (e.g. the grid control).
- The mouse is captured by another window (using CWnd::SetCapture).
For the first case you should not add the handler to the view but to the grid control (which requires modifying the sources of the grid control or deriving a new class).
-
Then there are two other possible sources:
- The message is handled by a window that is over your view (e.g. the grid control).
- The mouse is captured by another window (using CWnd::SetCapture).
For the first case you should not add the handler to the view but to the grid control (which requires modifying the sources of the grid control or deriving a new class).