• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 237
  • Last Modified:

Document template and view problem?

Dear experts:

Now, I am doing a course project using VC++ 5.0. In my project, I created three kinds of document template. One is CEditView used for text editing. The second is CTreeView used for file management similar to Windows Explorer. The third is CFormView to output some runtime information in a CEdit control within the CFormView.

In my CTreeView, I want to select a tree item ( i.e. a text file name) and open it to do the editing. This need to change the current CTreeView to CEditView, i.e. to open a CEditView document and view. I also want to select a text file in the CTreeView to process it and output information to the CEdit control of the CFormView. This also need to open a CFormView document and view.

Within a certain kind of document and view, how to open another kind of document and view and pass the document name to it? Until now, I still can not figure out a way to do that. Since this project is due soon. Any help will be much appreciated.

jzzhang
0
jzzhang
Asked:
jzzhang
1 Solution
 
piano_boxerCommented:
When registering doc/view relations your have something like this (You would have three):

pDocTemplate = new CMultiDocTemplate(
    IDR_MYTYPE,
    RUNTIME_CLASS(CMyDoc),
    RUNTIME_CLASS(CMyFrame),
    RUNTIME_CLASS(CMyView));

you should store the returned pDocTemplate pointer in a static variable. Later when you want to open a new doc/view of that specific type do this:

pDocTemplate->OpenDocumentFile(<filename>);


0
 
rernstCommented:
You can use the "CheckBook" example project (which comes with VC++ 4.0 and also
with  VC++ 1.52) as a template. The source code of this project contains all the
modifications that are necessary.

0
 
jzzhangAuthor Commented:
Thanks. I will try that!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now