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. Add / Remove Splitter Panes

Add / Remove Splitter Panes

Scheduled Pinned Locked Moved C / C++ / MFC
ai-modelshelpquestion
2 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.
  • B Offline
    B Offline
    Bert Tuyt
    wrote on last edited by
    #1

    I'm writing a application with a nested splitter The first spltter has 2 colomns, the second (in the right colomn) has a number of rows which I want to change programmically (between 2 and 5). In the present implementation I delete the second splitter when i need to add or remove a pane, and "built" the new one with the right number of rows. This implementation has a flaw because although I use the InitialUpdate for every view , nothing happens. Only when I "toutch the splitter-bar, I "see" the updated splitter. Does anyone no this problem and/or has a more elegant solution? I saw a proposal somewhere which hides panes. But in that case, can you then still enlarge the views with the mouse (which I don not want to be possible !) ? Thanks in advance, Bert....

    P 1 Reply Last reply
    0
    • B Bert Tuyt

      I'm writing a application with a nested splitter The first spltter has 2 colomns, the second (in the right colomn) has a number of rows which I want to change programmically (between 2 and 5). In the present implementation I delete the second splitter when i need to add or remove a pane, and "built" the new one with the right number of rows. This implementation has a flaw because although I use the InitialUpdate for every view , nothing happens. Only when I "toutch the splitter-bar, I "see" the updated splitter. Does anyone no this problem and/or has a more elegant solution? I saw a proposal somewhere which hides panes. But in that case, can you then still enlarge the views with the mouse (which I don not want to be possible !) ? Thanks in advance, Bert....

      P Offline
      P Offline
      pba_
      wrote on last edited by
      #2

      Here is the code who hide / show a row . This code is written especially to hide / show only a row at a time . You can use it also to hide / show more then one row, but be aware to the sequence of hide / show operations. Derive a class from CSplitterWnd, and add this code : void CMySplitterWnd::HideRow(int rowHide) { ASSERT(m_nRows > 1); ASSERT(rowHide < m_nRows); SetActivePane( 0, 0 ); CWnd* pPaneHide = GetPane(rowHide, 0); ASSERT(pPaneHide != NULL); pPaneHide->ShowWindow(SW_HIDE); pPaneHide->SetDlgCtrlID(AFX_IDW_PANE_FIRST + m_nRows); for( int row = rowHide + 1; row < m_nRows; row++ ) { CWnd* pPane = GetPane( row, 0 ); ASSERT( pPane != NULL ); pPane->SetDlgCtrlID( IdFromRowCol(row - 1, 0) ); m_pRowInfo[row-1] = m_pRowInfo[row]; } m_nRows--; m_pRowInfo[m_nRows] = m_pRowInfo[rowHide]; RecalcLayout(); } void CTSplitterWnd::ShowRow(int rowShow) { ASSERT(m_nRows < m_nMaxRows); int rowNew = rowShow; CRowColInfo rowNewInfo = m_pRowInfo[m_nRows]; m_nRows++; int row; CWnd* pPaneShow = GetDlgItem( AFX_IDW_PANE_FIRST + m_nRows); ASSERT(pPaneShow != NULL); pPaneShow->ShowWindow(SW_SHOWNA); for(row = m_nRows - 2; row >= rowNew; row--) { CWnd* pPane = GetPane(row, 0); ASSERT(pPane != NULL); pPane->SetDlgCtrlID(IdFromRowCol(row + 1, 0)); m_pRowInfo[row + 1] = m_pRowInfo[row]; } pPaneShow->SetDlgCtrlID(IdFromRowCol(rowNew, 0)); m_pRowInfo[rowNew] = rowNewInfo; RecalcLayout(); } On this base you can write the functions for hide / show a colon

      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