in view of MDI app OnMove() never happens
-
Hi When I create an "out-of-the-box" MDI application with the project wizard (using Visual C++ .NET 2003) with a CView as child (so every setting in the wizard is left on default) then the OnMove() function fires only twice - at the start of the application.
void CTestOnMoveView::OnMove(int x, int y) { TRACE("CTestOnMoveView::OnMove (%d/%d)\n", x, y); CView::OnMove(x, y); }
...results in...CTestOnMoveView::OnMove (0/0) CTestOnMoveView::OnMove (2/2)
Afterwards OnMove() is never called again, no matter how I move, resize, maximize and minimize the application window and/or the child window. Only if I close the document/childwindow and make a new one ("File"->"New") then OnMove() is called again twice, then no more afterwards. Sorry, I just don't get it X| OnResize() on the other hand works 100% as expected, firing every time the size of the window is someway changed. Any help welcome, thanks, T.T.H. / Matthias -
Hi When I create an "out-of-the-box" MDI application with the project wizard (using Visual C++ .NET 2003) with a CView as child (so every setting in the wizard is left on default) then the OnMove() function fires only twice - at the start of the application.
void CTestOnMoveView::OnMove(int x, int y) { TRACE("CTestOnMoveView::OnMove (%d/%d)\n", x, y); CView::OnMove(x, y); }
...results in...CTestOnMoveView::OnMove (0/0) CTestOnMoveView::OnMove (2/2)
Afterwards OnMove() is never called again, no matter how I move, resize, maximize and minimize the application window and/or the child window. Only if I close the document/childwindow and make a new one ("File"->"New") then OnMove() is called again twice, then no more afterwards. Sorry, I just don't get it X| OnResize() on the other hand works 100% as expected, firing every time the size of the window is someway changed. Any help welcome, thanks, T.T.H. / MatthiasThat is because the View never moves... The view window is actually a child window of your CChildFrame (from CMDIChildWnd), and (almost) always sits at (0,0). When you drag the "View" about, you are actually dragging the frame about. The view sits still relative to its parent window. When you resize the "View", you actually resize the frame. The frame resizes the View, which is why you get WM_SIZE messages! If you really need to know that you've moved, move your functionality into CChildFrame. The child frame can be useful, as you can (e.g) toolbars to each frame, instead of just having the main ones. Hopefully that made sense! Iain.