Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Objective Chart User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

20.3 SECDocManager: An MFC Application Document Manager

To allow the CApplication object to use the SECComDoc document type, you must modify the document manager. Normally, given a choice of several different document template types, the document manager simply asks the user which one is required in response to the OnFileNew() command. The ComDoc system adds the ability to decide in advance which document type should be invoked. The mechanism that displays the standard document choice dialog is extended for this purpose.

A string contained in the document resources identifies each separate document type registered in an application. This string contains the name of the document type, the file extension used, the document title text, and other information. By using SECDocManager and an overloaded version of OnFileNew(), it's possible to call up a file by using the document name stored in the template string. The prototype of this function is shown below.

The first parameter, DocIdent, should be the document's template string name. The other parameters are the op-code, sub-code, and data for the new document's initialization procedure and a pointer to the document that is to act as parent.

The following string is the document template string from the Objective Chart document used in the MultiGrph example:

Using this template, a graph document may be invoked using the "Graph" name as the DocIdent.

20.3.1 Using SECDocManager

You must make modifications to your CWinApp-derived class to include ComDoc functionality in your application.

  1. Add the following code to the class definition:

  2. Add the following code to the application class implementation:

These modifications allow the invocation of a document by its document template string name. Documents may also be initialized by sending data directly to them rather than going through the process of opening a disk file. It is this process that allows MultiGrph's Objective Grid document to create and initialize a separate document using Objective Chart.

See the MultiGrph sample source code for the complete implementation of a ComDoc application. MultiGrph uses the OC document and view classes CGraphDoc and SRGraphView directly, so you will only see grid-related classes in Visual Studio's Class View. For more information, see CMultigrphApp::InitInstance().



Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and Stingray, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.