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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CMainFrame::OnMouseMove() - NOT called !!!

Status
Not open for further replies.

Robertus

Programmer
Feb 16, 2001
81
RO
Hi there!

Please, someone help me with this:
I created a SDI app and added a handler for WM_MOUSEMOVE in CMainFrame.
The code looks like this:

void CMainFrame::OnMouseMove(UINT nFlags, CPoint point)
{
MessageBox("Called !!!");
CString s;
s.Format("X: %d, Y: %d",point.x,point.y);
m_wndStatusBar.SetPaneText(0,s);

CFrameWnd::OnMouseMove(nFlags, point);
}

but the "Called !!!" MessageBox doesn't show up!

WHY ????
 
Yes because the screen(actually the DC) belongs to the CView derived class not to the CMainFrame class.

If you put the same code in the view of your project you will see it works.


Hope this helps,s-) Blessed is he who in the name of justice and good will, shepards the week through the valley of darknees...
 
Put the event handler on your CDocument. John Fill
1c.bmp


ivfmd@mail.md
 
Reply for JohnFill:
I think your solution is not so good. Because:

1.Event handlers regarding the interface should always be put in the CView derived class(remember you can associate more than one view to a document):)I

2.In the document of a Document/View project should be place only methods that have to do with the members of the document (like serialization).:)I

There is always room for improvment...

Blessed is he who in the name of justice and good will, shepards the week through the valley of darknees...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top