Saving the file contents in a view class

I have an MDI application where each child document is divided into three panes.One pane has a treeview, another has a listview, 3rd pane has a normal CView. All the changes I make in these are stored in a single file. How do I implement serialization for these ?
  If I create an application with Richedit view as the base class,then all these are handled automatically.Some concepts include

1. On Saving a new document only once a save dialog is flashed.On saving subsequently the dialog box is not flashed.But the contents are saved.
2. Similarly on opening a saved document and then subsequently saving it doesn't flash the save dialog box.But the contents are saved.

All these I could implement in my application by setting a flag. Is there any other alternative to this which could make it more efficient? Is serialization behind it ?

3.On closing the document it automatically asks whether to save it in a Rich edit application. How do I track it in an ordinary application as mine? This is the major glitch I face.Pls help.

thanx in advance

Who is Participating?
aphillipsConnect With a Mentor Commented:
The three views should be different views of the same data stored in the associated document, or if they use different but related data all the data should be stored togetherin the document.  Thence serializing the document will save/restore the data.  You need to write the serialization code, of course.

The putting up of the "Save As" dialog in a new document is all handled by MFC.  Basically all you have to worry about is that if the user does something that changes the document you need to call SetModifiedFlag().

Does this answer your question?

ciraAuthor Commented:
There is only one document class for this application.How do i associate each view's changes to the document ? Will u suggest any sample code for this implementation.

thnx in advance.
Normally when you create a view you specify a document.  How do you create your views?
ciraAuthor Commented:
In my application I have many classes all derived from many View classes such as TreeView,ListView etc.Now i have understood the concept behind associating class data to the corresponding document.Thus enabling serialization.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.