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