?
Solved

Document template and view problem?

Posted on 1998-04-17
3
Medium Priority
?
231 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Accepted Solution

by:
piano_boxer earned 40 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

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