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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Changing a view in an SDI.

Changing a view in an SDI.

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
5 Posts 4 Posters 1 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.
  • V Offline
    V Offline
    VanHlebar
    wrote on last edited by
    #1

    I have an SDI application with multiple views available. Each view is derived from CFormView and is specified with a unique dialog ID. My question is how do I change the view from one view to a user select one? I have options off of the menu bar that the user selects, this puts all the view changes inside my CMainFrm class. I don't want to destroy the original view that the application starts with, but after that all of the new views can be destroyed after they are used and moved to a new one. Any help is appreciated. -Eric

    A V 2 Replies Last reply
    0
    • V VanHlebar

      I have an SDI application with multiple views available. Each view is derived from CFormView and is specified with a unique dialog ID. My question is how do I change the view from one view to a user select one? I have options off of the menu bar that the user selects, this puts all the view changes inside my CMainFrm class. I don't want to destroy the original view that the application starts with, but after that all of the new views can be destroyed after they are used and moved to a new one. Any help is appreciated. -Eric

      A Offline
      A Offline
      Anatari
      wrote on last edited by
      #2

      I had to do this a couple of months ago and found the articles about document/view here at code project helpful. There was also several examples in the MSDN library about this subject. http://www.codeproject.com/docview/switchingviews.asp[^] - Anatari

      V 1 Reply Last reply
      0
      • V VanHlebar

        I have an SDI application with multiple views available. Each view is derived from CFormView and is specified with a unique dialog ID. My question is how do I change the view from one view to a user select one? I have options off of the menu bar that the user selects, this puts all the view changes inside my CMainFrm class. I don't want to destroy the original view that the application starts with, but after that all of the new views can be destroyed after they are used and moved to a new one. Any help is appreciated. -Eric

        V Offline
        V Offline
        valikac
        wrote on last edited by
        #3

        Consider ShowWindow(). Kuphryn

        1 Reply Last reply
        0
        • A Anatari

          I had to do this a couple of months ago and found the articles about document/view here at code project helpful. There was also several examples in the MSDN library about this subject. http://www.codeproject.com/docview/switchingviews.asp[^] - Anatari

          V Offline
          V Offline
          VanHlebar
          wrote on last edited by
          #4

          Anatari, Thanks for the help. I am having one problem though. When I goto create my new view using te Create method I get a compile error of "Create: cannot access protected member declared in class CFormView" Here is what I am attempting per the article you suggested. if(!m_pMyView) MyView is a class derived from CFormView { m_pMyView = new CMyView; m_pMyView->Create(NULL, NULL, AFX_WS_DEFAULT_VIEW, CFrameWnd::rectDefault, AfxGetMainWnd(), AFX_IDW_PANE_FIRST+1, NULL); } I am doing this in the OnNewDocument of my Document class. Any ideas why I get this error? I have taken the constructor and destructors of my new Vew class and made them public and removed all the DECLARE_DYNCREATE and IMPLEMENT_DYNCREATE macros from the header and source files of the class. -Eric

          D 1 Reply Last reply
          0
          • V VanHlebar

            Anatari, Thanks for the help. I am having one problem though. When I goto create my new view using te Create method I get a compile error of "Create: cannot access protected member declared in class CFormView" Here is what I am attempting per the article you suggested. if(!m_pMyView) MyView is a class derived from CFormView { m_pMyView = new CMyView; m_pMyView->Create(NULL, NULL, AFX_WS_DEFAULT_VIEW, CFrameWnd::rectDefault, AfxGetMainWnd(), AFX_IDW_PANE_FIRST+1, NULL); } I am doing this in the OnNewDocument of my Document class. Any ideas why I get this error? I have taken the constructor and destructors of my new Vew class and made them public and removed all the DECLARE_DYNCREATE and IMPLEMENT_DYNCREATE macros from the header and source files of the class. -Eric

            D Offline
            D Offline
            deffer
            wrote on last edited by
            #5

            You have to override the create method in the CFormView derived class you're trying to show W. Zayas:)

            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