When file open is selected by the user the method,
CMyProgDoc::Serialize(CArchive& ar) is called.
I have in my application a LeftView class which is
derived from CTreeView...
My question is how do I pass the data in to the LeftView
class from the Doc Class?
I mean I could call a method of the LeftView class with the CArchive
as a parameter, but how do I get the instance of the LeftView class
within the Doc Class so that I can call the method?
Where should the data object that was read in from a file be stored
ie.. which class?
TIA
B
Last edited by bobbob; January 30th, 2005 at 08:59 PM.
MSDN:
"When data in a document changes, the view responsible for the changes typically calls the CDocument::UpdateAllViews function for the document, which notifies all the other views by calling the OnUpdate method for each. The default implementation of OnUpdate invalidates the entire client area of the view. You can override it to invalidate only those regions of the client area that map to the modified portions of the document."
So in you document add data to some class and call UpdateAllViews(), then in view OnUpdate call GetDocument() and check data in document.
So in you document add data to some class and call UpdateAllViews(), then in view OnUpdate call GetDocument() and check data in document.
Of course providing that view is wired to a document and document serves as repository of the view’s data and view does not hold any data that should be persistent outside of the document.
There are only 10 types of people in the world: Those who understand binary and those who do not.
OnUpdate is one of virtual overrides not a message handler. Simply choose add virtual function and wizard will insert it for you.
You will have to have GetDocument overridden too, and all data that is to be serialized should be in a document object, if you do not want to call view’s Serialize.
There are only 10 types of people in the world: Those who understand binary and those who do not.
Why does OnUpdate get called twice.
Is there something in the parameters to tell me why its being called?
How should I handle them so that I only have to display once per physical change?
MSDN:
"When data in a document changes, the view responsible for the changes typically calls the CDocument::UpdateAllViews function for the document, which notifies all the other views by calling the OnUpdate method for each. The default implementation of OnUpdate invalidates the entire client area of the view. You can override it to invalidate only those regions of the client area that map to the modified portions of the document."
So in your document add data to some class and call UpdateAllViews(), then in view OnUpdate call GetDocument() and check data in document.
This makes sence except that I want to get the CTreeView and I can only find a method to get the TreeCntrl. I want to update the tree. Do I use the CTreeView or do I use the CTreeCtrl?
CUPnPTKDoc* pDoc = GetDocument();
CTreeCtrl& Tree = GetTreeCtrl();
Last edited by bobbob; February 7th, 2005 at 05:30 PM.
Bookmarks