Solved

CView without a document

Posted on 1998-11-19
6
327 Views
Last Modified: 2013-11-20
When creating a SDI application without document/view support, the frame's view is derived from CWnd. Is it ok to derive this view from CView and not attach a document? Will I need to set the document pointer to NULL?
0
Comment
Question by:tds195
[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
6 Comments
 
LVL 1

Expert Comment

by:fstab
ID: 1324974
Yes it is perfectly allowable for you to derive it from CView and not attach a document. What do you mean by "Will I need to set the document pointer to NULL" - where do you want to set it to NULL ?
0
 
LVL 3

Expert Comment

by:plaroche
ID: 1324975
What in the CView(without a document) would you need that is not in a CWnd?
0
 

Author Comment

by:tds195
ID: 1324976
I was thinking about the fact that you normally use a CSingleDocTemplate to associate the document with the view and was wondering how where this association is made.2
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:tds195
ID: 1324977
I need to support printing and drag and drop.
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 1324978
what's the problem with having a document ?

0
 
LVL 3

Accepted Solution

by:
plaroche earned 50 total points
ID: 1324979
Also, what is a SDI without document/view support?  The D in SDI means Document.....

Yes you can replace it by a CView if your CView has a NULL document.  If you check MFC code most view class members check for a NULL document (see viewcore.cpp) and handle it correctly.  

Your printing mecanism will also work, the doctitle will come from the frame window's title (see viewprnt.cpp).

If your existing CWnd object that you wish to replace is already plugged in the command-message routing then you won't have any problems. If it is not plugged in your view won't get the ID_FILE_PRINT command to print its stuff.  Your frame might trap the message and relay it to the view or override OnCmdMsg in your frame and call the view's OnCmdMsg first. This will effectively plug the view in the command message routing.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
centeredAverage challenge 8 188
sumHeights  challenge 17 83
how to split multiple lines delimiter : 8 133
Problem to open Excel file 15 266
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Suggested Courses

751 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