Solved

Document template and view problem?

Posted on 1998-04-17
3
213 Views
Last Modified: 2010-04-10
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
Comment
Question by:jzzhang
3 Comments
 
LVL 4

Accepted Solution

by:
piano_boxer earned 10 total points
ID: 1161856
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
 

Expert Comment

by:rernst
ID: 1161857
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
 
LVL 2

Author Comment

by:jzzhang
ID: 1161858
Thanks. I will try that!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question