Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CView without a document

Posted on 1998-11-19
6
Medium Priority
?
331 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
Technology Partners: 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 150 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

722 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