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. Directly creating a CFormView as a child?

Directly creating a CFormView as a child?

Scheduled Pinned Locked Moved C / C++ / MFC
question
6 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.
  • D Offline
    D Offline
    DerekSaw
    wrote on last edited by
    #1

    How could we have an object (not dynamicall created) of CFormView (and derivatives)? I've tried: CSomeView someview; someview.Create(...); but they give me "An unsupported operation was attempted". Any way for me to create CSomeView manually (explicit call to Create() ) ? Or any suggestion/hack on allowing me to do this?

    A D 2 Replies Last reply
    0
    • D DerekSaw

      How could we have an object (not dynamicall created) of CFormView (and derivatives)? I've tried: CSomeView someview; someview.Create(...); but they give me "An unsupported operation was attempted". Any way for me to create CSomeView manually (explicit call to Create() ) ? Or any suggestion/hack on allowing me to do this?

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

      Why not just use a dialog box instead?

      1 Reply Last reply
      0
      • D DerekSaw

        How could we have an object (not dynamicall created) of CFormView (and derivatives)? I've tried: CSomeView someview; someview.Create(...); but they give me "An unsupported operation was attempted". Any way for me to create CSomeView manually (explicit call to Create() ) ? Or any suggestion/hack on allowing me to do this?

        D Offline
        D Offline
        DerekSaw
        wrote on last edited by
        #3

        To be exact, I want it to be a child (control?) in a (well-known)CSizableControlBar derivative.

        A 1 Reply Last reply
        0
        • D DerekSaw

          To be exact, I want it to be a child (control?) in a (well-known)CSizableControlBar derivative.

          A Offline
          A Offline
          aldeba
          wrote on last edited by
          #4

          It should not be a problem to create a CFormView can be seen from this example http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0998/c++0998.htm&nav=/msj/0998/newnav.htm

          D 1 Reply Last reply
          0
          • A aldeba

            It should not be a problem to create a CFormView can be seen from this example http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0998/c++0998.htm&nav=/msj/0998/newnav.htm

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

            hmm... the example doesn't show me how to create a CFormView DIRECTLY... nice article though. thanx :) What I want is, the CFormView is not created dynamically under a CSplitterWnd, but I want it to be under a CControlBar... and created (maybe) in OnCreate() of CControlBar by calling CFormView::Create().

            M 1 Reply Last reply
            0
            • D DerekSaw

              hmm... the example doesn't show me how to create a CFormView DIRECTLY... nice article though. thanx :) What I want is, the CFormView is not created dynamically under a CSplitterWnd, but I want it to be under a CControlBar... and created (maybe) in OnCreate() of CControlBar by calling CFormView::Create().

              M Offline
              M Offline
              Michael P Butler
              wrote on last edited by
              #6

              I don't know if this of any help but I use this for create CFormView's on the fly. #define VIEWS_RECALLING_VIEW AFX_IDW_PANE_FIRST + 5 m_pRecallingView = new CRecallingView; AddView(m_pRecallingView, VIEWS_RECALLING_VIEW); } void CCTIReceptionApp::AddView(CView* pView, UINT nID) { CDocument* pCurrentDoc = ((CFrameWnd*) m_pMainWnd)->GetActiveDocument(); CCreateContext newContext; newContext.m_pNewViewClass = NULL; newContext.m_pNewDocTemplate = NULL; newContext.m_pLastView = NULL; newContext.m_pCurrentFrame = NULL; newContext.m_pCurrentDoc = pCurrentDoc; CRect rect(0,0,0,0); char szTemp[64]; sprintf(szTemp, "ViewList%x", nID); pView->Create(NULL, NULL, (AFX_WS_DEFAULT_VIEW & ~WS_VISIBLE), // views are created with the style of AFX_WS_DEFAULT_VIEW // In MFC 4.0, this is (WS_BORDER | WS_VISIBLE | WS_CHILD) rect, m_pMainWnd, nID, &newContext); pView->SendMessage(WM_INITIALUPDATE, 0, 0); } Michael :-) Logic, my dear Zoe, merely enables one to be wrong with authority. - The Doctor

              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