mouse events
-
Hi I'm having a lot of problems with mouse events. In an MDI application I have a CDialogBar derived class which needs to keep track of mouse movements in the parent frame. Using the ClassWizard I've added the necessary functions but they don't work. Within the CDialogBar derived class there's a CEdit object. Within the WM_NCMOUSEMOVE event handler the CEdit object has it's window text set to the mouse position. Well nothing happens. The application runs, but for whatever reason the dialog bar doesn't get the non-client mouse move event. I've added handlers for WM_NCLBUTTONDOWN and WM_NCLBUTTONUP but nothing happens. Can anyone tell me what's going on? How do I make my CDialogBar derived class capture mouse events in the parent frame?
-
Hi I'm having a lot of problems with mouse events. In an MDI application I have a CDialogBar derived class which needs to keep track of mouse movements in the parent frame. Using the ClassWizard I've added the necessary functions but they don't work. Within the CDialogBar derived class there's a CEdit object. Within the WM_NCMOUSEMOVE event handler the CEdit object has it's window text set to the mouse position. Well nothing happens. The application runs, but for whatever reason the dialog bar doesn't get the non-client mouse move event. I've added handlers for WM_NCLBUTTONDOWN and WM_NCLBUTTONUP but nothing happens. Can anyone tell me what's going on? How do I make my CDialogBar derived class capture mouse events in the parent frame?
-
Have you tried to handle these events in CMainFrame and then let CMainFrame call a user defined function in your derived CDialogBar class? Rob Whoever said nothing's impossible never tried slamming a revolving door!
I just tried that, and it doesn't work. The code compiles, and application runs but the CFrameWnd derived class still doesn't get any mouse events. I also tried OnNcMouseMove(UINT nHitTest, CPoint point) in the dialog bar, but no dice. I'm at a total loss...there must be something I'm missing. I can email you the project, maybe you can figure it out.
-
I just tried that, and it doesn't work. The code compiles, and application runs but the CFrameWnd derived class still doesn't get any mouse events. I also tried OnNcMouseMove(UINT nHitTest, CPoint point) in the dialog bar, but no dice. I'm at a total loss...there must be something I'm missing. I can email you the project, maybe you can figure it out.
I would try to handle the WM_MOUSEMOVE event with in CMainFrame or CFrameWnd (SDI or MDI) what ever the case maybe.. You can even try to do TRACE("Mouse Moving\n"); With in a bunch of functions in the MainFrame or ChildFrame classes to see what window is receiving the messages you are looking for.. here is a example of handling the WM_MOUSEMOVE with in CMainFrame class.. note this is by hand, I havent compiled it.
void CMainFrame::OnMouseMove(UINT nFlags, CPoint point)
{
// Handle the movement here.. Maybe do a m_wndDlgBar->SomeFunction(point)
// Or what ever you need to do to get the needed info to the CDialogBar Class..CFrameWnd::OnMouseMove(nFlags, point);
}
Rob Whoever said nothing's impossible never tried slamming a revolving door!
-
Hi I'm having a lot of problems with mouse events. In an MDI application I have a CDialogBar derived class which needs to keep track of mouse movements in the parent frame. Using the ClassWizard I've added the necessary functions but they don't work. Within the CDialogBar derived class there's a CEdit object. Within the WM_NCMOUSEMOVE event handler the CEdit object has it's window text set to the mouse position. Well nothing happens. The application runs, but for whatever reason the dialog bar doesn't get the non-client mouse move event. I've added handlers for WM_NCLBUTTONDOWN and WM_NCLBUTTONUP but nothing happens. Can anyone tell me what's going on? How do I make my CDialogBar derived class capture mouse events in the parent frame?
I just downloaded the zip and made the adjustments.. I just emailed the project back to you.. Just incase here is the code...
LRESULT CChildView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
if(message == WM_MOUSEMOVE)
{
CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd();
ASSERT(pMain);
TRACE("Mouse Movement\n");
CPoint point = (CPoint)lParam;
CString str;
str.Format("OnMouseMove at (%d,%d)",point.x,point.y);
pMain->SetMessageText(_T(str));
}return CWnd ::WindowProc(message, wParam, lParam);
}
Rob Whoever said nothing's impossible never tried slamming a revolving door!