Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. ID_File_New

ID_File_New

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tara14
    wrote on last edited by
    #1

    Hi, I have created a SDI with FormView. The data from the view can be stored into a file and when the file is clicked, it opens directly into the formview with the edit boxes automatically filled. Now, when one file/document is open, if the user selects File-New from the menu, a new document opens and all the fields on the Form get reset (set to zero). The previously open document gets closed. I would like to ask the user if he would like to save the data before opening a new document. I have put this option when the Exit button is clicked, but am not able to figure out how to **open a new document** after the saving process is over. Please help!

    _


    Fortitudine Vincimus!_

    P D 2 Replies Last reply
    0
    • T Tara14

      Hi, I have created a SDI with FormView. The data from the view can be stored into a file and when the file is clicked, it opens directly into the formview with the edit boxes automatically filled. Now, when one file/document is open, if the user selects File-New from the menu, a new document opens and all the fields on the Form get reset (set to zero). The previously open document gets closed. I would like to ask the user if he would like to save the data before opening a new document. I have put this option when the Exit button is clicked, but am not able to figure out how to **open a new document** after the saving process is over. Please help!

      _


      Fortitudine Vincimus!_

      P Offline
      P Offline
      PJ Arends
      wrote on last edited by
      #2

      Override CDocument::OnCloseDocument().


      You may be right
      I may be crazy
      -- Billy Joel --

      Within you lies the power for good, use it!!!

      T 1 Reply Last reply
      0
      • P PJ Arends

        Override CDocument::OnCloseDocument().


        You may be right
        I may be crazy
        -- Billy Joel --

        Within you lies the power for good, use it!!!

        T Offline
        T Offline
        Tara14
        wrote on last edited by
        #3

        AH!! This works ... Is it the correct way? I added this in the MainFrame Class:

        void CMainFrame::OnFileNew()
        {
        CSFPAView *pFV = (CSFPAView *)GetActiveView();
        if (pFV->DoBeforeExit())
        {
        CSingleDocTemplate * pTemplate = (CSingleDocTemplate *) GetActiveDocument()->GetDocTemplate();
        pTemplate->OpenDocumentFile(NULL);
        }

        }

        _


        Fortitudine Vincimus!_

        1 Reply Last reply
        0
        • T Tara14

          Hi, I have created a SDI with FormView. The data from the view can be stored into a file and when the file is clicked, it opens directly into the formview with the edit boxes automatically filled. Now, when one file/document is open, if the user selects File-New from the menu, a new document opens and all the fields on the Form get reset (set to zero). The previously open document gets closed. I would like to ask the user if he would like to save the data before opening a new document. I have put this option when the Exit button is clicked, but am not able to figure out how to **open a new document** after the saving process is over. Please help!

          _


          Fortitudine Vincimus!_

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          Tara14 wrote:

          I would like to ask the user if he would like to save the data before opening a new document.

          If the document contents have not changed, no prompt is necessary. Otherwise, look at the SetModifiedFlag() method.


          "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

          "Judge not by the eye but by the heart." - Native American Proverb

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups