phsetr.blogg.se

Mfc application wizard multiple top level documents
Mfc application wizard multiple top level documents










mfc application wizard multiple top level documents

You can then initialize each data member in the class constructor and use appropriate set and get member functions to manipulate each data member. You create data members in the CDocument class by adding declarations for each data member to the interface file, the same way you create data members in other classes. Override CDocument’s Serialize() member function in order to read the document’s data from and write the document’s data to a file. Override the CDocument class’s member functions to customize the creating, loading, and saving mechanisms of the document/view architecture. Note that you execute the UpdateAllViews() function from a derived CDocument class, not a derived CView class.ġ8 CDocument Once the MFC Application Wizard creates your derived document class, you may perform the following tasks: Create data members to temporarily hold the data for the current document. Passing a single value of NULL to the UpdateAllViews() function informs the system that all views in the program should be updated. The UpdateAllViews() function is a member function of CDocument and causes each view window’s OnUpdate() function to execute in order to allow each view to display the most recent data. The OnUpdate() function allows all of the view windows in an application to display the most current data. The GetDocument() function returns a pointer to the m_pDocument data member that you can use anywhere in the view class when you need to access the document’s data.ġ6 CView::OnUpdate() Each view class inherits an OnUpdate() function that is called each time the document class changes or whenever the document class executes an UpdateAllViews() function.

mfc application wizard multiple top level documents

The GetDocument() function returns a pointer to the document associated with a view.

mfc application wizard multiple top level documents

The primary CView class member functions that you use to display and manipulate data are as follows: OnDraw() GetDocument() OnUpdate() The CView class contains various functions for displaying and manipulating data. The CView window completely covers the frame window’s client area, but does not cover visual interface elements such as the title bar or scroll bars.ġ3 CView Child Classes The classes that derive from CView are used for creating more specialized view windows:Ī view class is responsible for graphically displaying a document’s data and for handling the manipulation of that data according to user requests. This means the CView window is a child of a frame window.

mfc application wizard multiple top level documents

The Multiple top-level document interface, allows user to have multiple individual SDI instances as a single instance of an MDI Application.ġ0 Multiple Top-level Documents Interface Example: Word 2000+ġ1 CView You display a window created from a class derived from CView within a frame window. The multiple document interface, or MDI, allows users to have multiple documents open at the same time. How a document-based program’s data is displayed to the user is controlled by one or more classes derived from the CView class.ĥ Documents and Views The following figure illustrates the concept of multiple CView classes that display and manipulate the data contained in a single CDocument classħ Document Interfaces The single document interface, or SDI, allows users to have only one document open at a time. Presentation on theme: "Document/View Architecture"- Presentation transcript:ĬITA 342 Section 5 Document/View ArchitectureĢ Documents and Views The MFC document/view architecture separates a program’s data from the way that data is displayed and accessed by users.ģ Documents and Views A program’s data (the document) is managed and stored by a class derived from the CDocument class.












Mfc application wizard multiple top level documents