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