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. How do I stop my view from being erased after serialising the document???

How do I stop my view from being erased after serialising the document???

Scheduled Pinned Locked Moved C / C++ / MFC
data-structuresquestiongraphicshelptutorial
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.
  • A Offline
    A Offline
    Ananya Sen Gupta
    wrote on last edited by
    #1

    OK.. I am drawing a graph in my view and then want to save the point array in my document. Problem arises when i serialise.. During run, when I try to save it, he save window comes up fine.. but the graph is erased when my view is redrawn after closing the save dialog box. I did put invalidateRect in my OnDraw function .. but didn't work!! I also added a call to UpdateAllWindows in the overriden Serialize function for my CDocument.. but still does not work!!! also, anyone knows how to obtain a pointer to the current view from CDocument?? It is what we choose to be that makes us what we are, far more than our abilities. -J.K. Rowling

    C 1 Reply Last reply
    0
    • A Ananya Sen Gupta

      OK.. I am drawing a graph in my view and then want to save the point array in my document. Problem arises when i serialise.. During run, when I try to save it, he save window comes up fine.. but the graph is erased when my view is redrawn after closing the save dialog box. I did put invalidateRect in my OnDraw function .. but didn't work!! I also added a call to UpdateAllWindows in the overriden Serialize function for my CDocument.. but still does not work!!! also, anyone knows how to obtain a pointer to the current view from CDocument?? It is what we choose to be that makes us what we are, far more than our abilities. -J.K. Rowling

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      To get a pointer to the View from your document:

      CFrameWnd *pFrameWnd = (CFrameWnd *)AfxGetMainWnd();
      ASSERT (pFrameWnd != NULL && pFrameWnd->IsKindOf(RUNTIME_CLASS(CMDIFrameWnd)));
      pFrameWnd = ((CMDIFrameWnd *)pFrameWnd)->GetActiveFrame();
      CMyView * pView = (CMyView*)pFrameWnd->GetActiveView();

      This is a generic method - it works from anywhere, but only works if your document is attached to the active view. Your other problem is a mystery to me. Could you post some code to show what you're doing ? Christian #include "std_disclaimer.h" People who love sausage and respect the law should never watch either one being made. The things that come to those who wait are usually the things left by those who got there first.

      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