Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. in view of MDI app OnMove() never happens

in view of MDI app OnMove() never happens

Scheduled Pinned Locked Moved C / C++ / MFC
c++csharpdebugginghelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    T T H
    wrote on last edited by
    #1

    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

    I 1 Reply Last reply
    0
    • T T T H

      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

      I Offline
      I Offline
      Iain Clarke Warrior Programmer
      wrote on last edited by
      #2

      That 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.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups