http://msdn.microsoft.com/en-us/library/aa241093(v=vs.60).aspx | How Do I | Details | http://msdn.microsoft.com/en-us/library/f35t8fts(v=vs.60).aspx | http://msdn.microsoft.com/en-us/library/aa716466(v=vs.60).aspx
By default, MFC applications use a programming model that separates a program’s data from the display of that data and from most user interaction with the data. In this model, an MFC document object reads and writes data to persistent storage. The document may also provide an interface to the data wherever it resides (such as in a database). A separate view object manages data display, from rendering the data in a window to user selection and editing of data. The view obtains display data from the document and communicates back to the document any data changes.
While you can easily override or ignore the document/view separation, there are compelling reasons to follow this model in most cases. One of the best is when you need multiple views of the same document, such as both a spreadsheet and a chart view. The document/view model lets a separate view object represent each view of the data, while code common to all views (such as a calculation engine) can reside in the document. The document also takes on the task of updating all views whenever the data changes.
MFC’s document/view architecture makes it easy to support multiple views, multiple document types, splitter windows, and other valuable user-interface features. At the heart of document/view are four key classes:
- (or ), an object used to store or control your program’s data.
- (or one of its many derived classes), an object used to display a document’s data and manage user interaction with the data.
- (or one of its variations), an object that provides the frame around one or more views of a document.
- (or or ), an object that coordinates one or more existing documents of a given type and manages creating the correct document, view, and frame window objects for that type.
What do you want to do?
- Learn more about document/view
- Learn the advantages of document/view
- Learn more about:
Learn how MFC creates a document and its views and frame window(s)
Create a program with multiple document types, such as text documents and graphics documents
Create a document with multiple views
Create a splitter window, with separate panes containing instances of the same or different view objects
- Learn about alternatives to document/view.