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. Dynamic CSplitterWnd

Dynamic CSplitterWnd

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

    I have created a dynamic splitter with: CSplitterWnd clientSplitter; .. clientSplitter.Create(this, 2, 2, CSize(200, 200), pContext, WS_CHILD | WS_VISIBLE | SPLS_DYNAMIC_SPLIT, AFX_IDW_PANE_FIRST); How do I add a view to it? This code .. clientSplitter.CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(100, 100), pContext); .. causes an ASSERT.

    cheers, Neil

    M 2 Replies Last reply
    0
    • N neilsolent

      I have created a dynamic splitter with: CSplitterWnd clientSplitter; .. clientSplitter.Create(this, 2, 2, CSize(200, 200), pContext, WS_CHILD | WS_VISIBLE | SPLS_DYNAMIC_SPLIT, AFX_IDW_PANE_FIRST); How do I add a view to it? This code .. clientSplitter.CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(100, 100), pContext); .. causes an ASSERT.

      cheers, Neil

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      And the assertion is....?

      N 1 Reply Last reply
      0
      • M Mark Salsbery

        And the assertion is....?

        N Offline
        N Offline
        neilsolent
        wrote on last edited by
        #3

        Sorry, assertion is in WINSPLIT.CPP: if (GetDlgItem(IdFromRowCol(row, col)) != NULL) { TRACE2("Error: CreateView - pane already exists for row %d, col %d.\n", row, col); ASSERT(FALSE); return FALSE; } cheers, Neil

        M 1 Reply Last reply
        0
        • N neilsolent

          Sorry, assertion is in WINSPLIT.CPP: if (GetDlgItem(IdFromRowCol(row, col)) != NULL) { TRACE2("Error: CreateView - pane already exists for row %d, col %d.\n", row, col); ASSERT(FALSE); return FALSE; } cheers, Neil

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          A dynamic splitter creates the first default pane (cell 0,0) so you can't create another view there. You may need to use DeleteView() on that pane first before adding your own pane. I'd have to test this as I've only used static splitters. Mark

          1 Reply Last reply
          0
          • N neilsolent

            I have created a dynamic splitter with: CSplitterWnd clientSplitter; .. clientSplitter.Create(this, 2, 2, CSize(200, 200), pContext, WS_CHILD | WS_VISIBLE | SPLS_DYNAMIC_SPLIT, AFX_IDW_PANE_FIRST); How do I add a view to it? This code .. clientSplitter.CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(100, 100), pContext); .. causes an ASSERT.

            cheers, Neil

            M Offline
            M Offline
            Mark Salsbery
            wrote on last edited by
            #5

            I got around to testing it. This should work...

            BOOL CMyFrameWnd::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
            {
            CCreateContext CreateContext;
            CreateContext.m_pCurrentFrame = this;
            CreateContext.m_pNewViewClass = RUNTIME_CLASS(CLeftView);

            clientSplitter.Create(this, 2, 2, CSize(200, 200), &CreateContext,
            WS_CHILD | WS_VISIBLE | SPLS_DYNAMIC_SPLIT, AFX_IDW_PANE_FIRST);

            return TRUE;
            }

            N 1 Reply Last reply
            0
            • M Mark Salsbery

              I got around to testing it. This should work...

              BOOL CMyFrameWnd::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
              {
              CCreateContext CreateContext;
              CreateContext.m_pCurrentFrame = this;
              CreateContext.m_pNewViewClass = RUNTIME_CLASS(CLeftView);

              clientSplitter.Create(this, 2, 2, CSize(200, 200), &CreateContext,
              WS_CHILD | WS_VISIBLE | SPLS_DYNAMIC_SPLIT, AFX_IDW_PANE_FIRST);

              return TRUE;
              }

              N Offline
              N Offline
              neilsolent
              wrote on last edited by
              #6

              Thanks. That works fine.

              cheers, Neil

              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