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. Splitter with fixed size

Splitter with fixed size

Scheduled Pinned Locked Moved C / C++ / MFC
algorithmshelpquestion
9 Posts 4 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
    Dialecticus
    wrote on last edited by
    #1

    I have SDI application and two panes. I would like bottom pane to have fixed size (instead of top pane having it). When user moves splitting line bottom pane should maintain newly fixed size. When window is resized, so that there is no room for top pane, bottom pane should occupy whole area. When window is enlarged again bottom pane should occupy last fixed size (ie. enlarge to a certain point and then stay fixed). Standard CSplitterWnd does not have this functionality, and last pane is always expanded to the end, and all previous panes are fixed. I was searching here for appropriate splitter class, but no luck so far. Maybe I'm missing something obvious. Is there a ready made solution? How should I solve this problem?

    A T G 4 Replies Last reply
    0
    • D Dialecticus

      I have SDI application and two panes. I would like bottom pane to have fixed size (instead of top pane having it). When user moves splitting line bottom pane should maintain newly fixed size. When window is resized, so that there is no room for top pane, bottom pane should occupy whole area. When window is enlarged again bottom pane should occupy last fixed size (ie. enlarge to a certain point and then stay fixed). Standard CSplitterWnd does not have this functionality, and last pane is always expanded to the end, and all previous panes are fixed. I was searching here for appropriate splitter class, but no luck so far. Maybe I'm missing something obvious. Is there a ready made solution? How should I solve this problem?

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

      Does this help? If not, more here on splitters.

      D 1 Reply Last reply
      0
      • A App_

        Does this help? If not, more here on splitters.

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

        In linked article there is no mention of fixing the size of particular pane. The only advantage of featured class is that it works on CDialog, and that it uses registry. I've checked all other splitting classes, but either required functionality does not exist, or I can't find it. Hence the original question.

        1 Reply Last reply
        0
        • D Dialecticus

          I have SDI application and two panes. I would like bottom pane to have fixed size (instead of top pane having it). When user moves splitting line bottom pane should maintain newly fixed size. When window is resized, so that there is no room for top pane, bottom pane should occupy whole area. When window is enlarged again bottom pane should occupy last fixed size (ie. enlarge to a certain point and then stay fixed). Standard CSplitterWnd does not have this functionality, and last pane is always expanded to the end, and all previous panes are fixed. I was searching here for appropriate splitter class, but no luck so far. Maybe I'm missing something obvious. Is there a ready made solution? How should I solve this problem?

          T Offline
          T Offline
          TheGreatAndPowerfulOz
          wrote on last edited by
          #4

          handle the WM_SIZE message in the parent class (parent of splitter), then size each splitter panel appropriately.

          If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
          You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun

          D 1 Reply Last reply
          0
          • T TheGreatAndPowerfulOz

            handle the WM_SIZE message in the parent class (parent of splitter), then size each splitter panel appropriately.

            If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
            You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun

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

            My current solution is a monstrosity of a workaround that includes CMainFrame::OnSize handler, and a class derived from CSplitterWnd that exposes "ideal" sizes (you can set them but can't get them), and reroutes TrackRowSize/TrackColumnSize to CMainFrame so that proper size fiddling can be achieved. I am not proud of it, but it seems to be working for now.

            1 Reply Last reply
            0
            • D Dialecticus

              I have SDI application and two panes. I would like bottom pane to have fixed size (instead of top pane having it). When user moves splitting line bottom pane should maintain newly fixed size. When window is resized, so that there is no room for top pane, bottom pane should occupy whole area. When window is enlarged again bottom pane should occupy last fixed size (ie. enlarge to a certain point and then stay fixed). Standard CSplitterWnd does not have this functionality, and last pane is always expanded to the end, and all previous panes are fixed. I was searching here for appropriate splitter class, but no luck so far. Maybe I'm missing something obvious. Is there a ready made solution? How should I solve this problem?

              G Offline
              G Offline
              Goto_Label_
              wrote on last edited by
              #6

              First read Minimum size splitter then try: CSplitterWnd::SetRowInfo (horizontal) Call this member function to set a new minimum height and ideal height for a row. The row minimum value determines when the row will be too small to be fully displayed. When the framework displays the splitter window, it lays out the panes in columns and rows according to their ideal dimensions, working from the upper-left to the lower-right corner of the splitter window's client area.

              void CMyFrame::OnSize(UINT nType, int cx, int cy)
              {
              if(::IsWindow(m_wndSplitter.m_hWnd) && ::IsWindow(m_wndSplitter2.m_hWnd))
              {
              m_wndSplitter.SetRowInfo(0, cy*2/3, 10);
              m_wndSplitter.SetRowInfo(1, cy/3, 10);

              	m\_wndSplitter2.SetColumnInfo(0, cx/4, 10);
              	m\_wndSplitter2.SetColumnInfo(1, cx\*3/4, 10);
              		
              	RecalcLayout();
              }
              

              }

              CSplitterWnd::SetColumnInfo (verticle) Call this member function to set a new minimum width and ideal width for a column. The column minimum value determines when the column will be too small to be fully displayed. When the framework displays the splitter window, it lays out the panes in columns and rows according to their ideal dimensions, working from the upper-left to the lower-right corner of the splitter window's client area. Example

              void CChildFrame::OnSize(UINT nType, int cx, int cy)
              {
              CMDIChildWnd::OnSize(nType, cx, cy);

              CRect rect;
              GetWindowRect( &rect );
              if( m_bSplitterCreated ) // m_bSplitterCreated set in OnCreateClient
              {
              m_wndSplitter.SetColumnInfo(0, rect.Width()/2, 10);
              m_wndSplitter.SetColumnInfo(1, rect.Width()/2, 10);
              m_wndSplitter.RecalcLayout();
              }
              }

              CSplitterWnd::RecalcLayout Call this member function to correctly redisplay the splitter window after you have adjusted row and column sizes with the SetRowInfo and SetColumnInfo member functions. If you change row and column sizes as part of the creation process before the splitter window is visible, it is not necessary to call this member function.

              D 1 Reply Last reply
              0
              • G Goto_Label_

                First read Minimum size splitter then try: CSplitterWnd::SetRowInfo (horizontal) Call this member function to set a new minimum height and ideal height for a row. The row minimum value determines when the row will be too small to be fully displayed. When the framework displays the splitter window, it lays out the panes in columns and rows according to their ideal dimensions, working from the upper-left to the lower-right corner of the splitter window's client area.

                void CMyFrame::OnSize(UINT nType, int cx, int cy)
                {
                if(::IsWindow(m_wndSplitter.m_hWnd) && ::IsWindow(m_wndSplitter2.m_hWnd))
                {
                m_wndSplitter.SetRowInfo(0, cy*2/3, 10);
                m_wndSplitter.SetRowInfo(1, cy/3, 10);

                	m\_wndSplitter2.SetColumnInfo(0, cx/4, 10);
                	m\_wndSplitter2.SetColumnInfo(1, cx\*3/4, 10);
                		
                	RecalcLayout();
                }
                

                }

                CSplitterWnd::SetColumnInfo (verticle) Call this member function to set a new minimum width and ideal width for a column. The column minimum value determines when the column will be too small to be fully displayed. When the framework displays the splitter window, it lays out the panes in columns and rows according to their ideal dimensions, working from the upper-left to the lower-right corner of the splitter window's client area. Example

                void CChildFrame::OnSize(UINT nType, int cx, int cy)
                {
                CMDIChildWnd::OnSize(nType, cx, cy);

                CRect rect;
                GetWindowRect( &rect );
                if( m_bSplitterCreated ) // m_bSplitterCreated set in OnCreateClient
                {
                m_wndSplitter.SetColumnInfo(0, rect.Width()/2, 10);
                m_wndSplitter.SetColumnInfo(1, rect.Width()/2, 10);
                m_wndSplitter.RecalcLayout();
                }
                }

                CSplitterWnd::RecalcLayout Call this member function to correctly redisplay the splitter window after you have adjusted row and column sizes with the SetRowInfo and SetColumnInfo member functions. If you change row and column sizes as part of the creation process before the splitter window is visible, it is not necessary to call this member function.

                D Offline
                D Offline
                Dialecticus
                wrote on last edited by
                #7

                Thank you for MSDN reference, but my goal has nothing to do with splitter's minimum size. The ideal solution would be the one that has different RecalcLayout algorithm that recalculates layout the way I want it, having in mind what panes have fixed size (until user changes it), and what panes should be resized when the window is resized. Currently only the last pane is resized (the rightmost, or the "bottomest"), and all previous are fixed. Along with RecalcLayout rewrite there should be an update in TrackRowSize/TrackColumnSize so that fixed panes remain fixed (unless the user is resizing one just now), and resizable panes get resized to compensate for current pane reconfiguration.

                1 Reply Last reply
                0
                • D Dialecticus

                  I have SDI application and two panes. I would like bottom pane to have fixed size (instead of top pane having it). When user moves splitting line bottom pane should maintain newly fixed size. When window is resized, so that there is no room for top pane, bottom pane should occupy whole area. When window is enlarged again bottom pane should occupy last fixed size (ie. enlarge to a certain point and then stay fixed). Standard CSplitterWnd does not have this functionality, and last pane is always expanded to the end, and all previous panes are fixed. I was searching here for appropriate splitter class, but no luck so far. Maybe I'm missing something obvious. Is there a ready made solution? How should I solve this problem?

                  T Offline
                  T Offline
                  TheGreatAndPowerfulOz
                  wrote on last edited by
                  #8

                  I wonder if what you want to use is CDockablePane. The MFC "Visual Studio" Project style (available in VS2010) demonstrates usage of the CDockablePane and has the behavior you're describing.

                  If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
                  You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun

                  D 1 Reply Last reply
                  0
                  • T TheGreatAndPowerfulOz

                    I wonder if what you want to use is CDockablePane. The MFC "Visual Studio" Project style (available in VS2010) demonstrates usage of the CDockablePane and has the behavior you're describing.

                    If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
                    You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun

                    D Offline
                    D Offline
                    Dialecticus
                    wrote on last edited by
                    #9

                    Funny this. I created project from VS template and tested it a bit. If you shrink the window to a minimum then left and right dockable panes will also shrink and will not grow back. Then I tried the same thing with Visual Studio itself and the same thing happens. Dockable panes shrink, but do not grow back. But at least we have middle area that takes all the non-fixed space. If those dockable panes could be prevented from undocking, hiding, auto-hiding, and if they could be made without titlebars, so that they resemble another client area, then I would have something close to original idea. But without the panes growing back when there's available space.

                    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