Solved

Document template and view problem?

Posted on 1998-04-17
3
204 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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks. I will try that!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
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.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now