Solved

Document template and view problem?

Posted on 1998-04-17
3
220 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

730 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