Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Reload a document to a previously saved state.

Posted on 1998-09-29
6
Medium Priority
?
215 Views
Last Modified: 2013-11-20
I created a small program. It works fine, but when I reload an already loaded and modified document that has been previously saved, I don't get a warning saying that I'm about to loose the modifications of my document nor do I get the reloaded document. The loading does not occur.
But things work fine if I load another document.
0
Comment
Question by:stephaneeybert
  • 4
  • 2
6 Comments
 
LVL 3

Accepted Solution

by:
plaroche earned 200 total points
ID: 1322691
The warning should come when the current document is about to be closed. To have that warning you have to indicate that the document has been modified via the SetModifiedFlag(TRUE).

If your application is SDI OnNewDocument won't be called again when opening another document, OnOpenDocument will be. If you are doing something in OnNewDocument then it'll only be done once, that may explain your problem of the second document not being loaded.
0
 

Author Comment

by:stephaneeybert
ID: 1322692
Dear plaroche, I'm already using the function SetModifiedFlag(). My program is a SDI. This function allows me to get a warning when I attempt to close a document that has been modified since its last save. It also gives me a warning when I attempt to load another document if the current document has been modified since its last save. But it does not give me a warning when I attempt to reload the same document if the current document has been modified since its last save. The program Notepad does this fine. My program would not reload an already loaded and modified document. My program should not only reload the current document, but also should give me a warning that I'm loading an old version of the document. I hope you see the problem now.
Thanks for your answer anyway.
0
 
LVL 3

Expert Comment

by:plaroche
ID: 1322693
May I ask what is the behavior? Have you placed a breakpoint in OnOpenDocument() does it get called?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:stephaneeybert
ID: 1322694
I did not override OnOpenDocument.
The behavior of my program is that when I try to reload an already loaded and even modified document, the document is not reloaded. Therefore I did not think overriding OnOpenDocument was the answer to the problem. But then again, I might be wrong.
I propose you to email me directly if you wish to, at stephane_eybert@prqa.co.uk

0
 

Author Comment

by:stephaneeybert
ID: 1322695
I did not override OnOpenDocument.
The behavior of my program is that when I try to reload an already loaded and even modified document, the document is not reloaded. Therefore I did not think overriding OnOpenDocument was the answer to the problem. But then again, I might be wrong.
I propose you to email me directly if you wish to, at stephane_eybert@prqa.co.uk

0
 

Author Comment

by:stephaneeybert
ID: 1322696
Dear Plaroche, I read in the book Inside Visual C++ that MFC does not handle the functionality I am asking for. I don't know why such a basic capability is not taken care of by MFC. A solution to this well known problem (cf D. Kruklingski Inside Visual C++) should exist somewhere.
0

Featured Post

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!

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .

876 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