Splitter, "OnSize strikes back !"
-
Hi;), i have a Sdi with a splitter (4 rows). When i click on the maximize button the window is maximized and the 1. splitter row changes its height proportionally ;) , but when i try to restore, nothing happens with the Splitter ;(. Please help me ! Here is my code:
/************************************************************************/
/* Resizen des Splitters */
/************************************************************************/
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{int iCurRow\_cy = 0, iMin\_cy = 0; static int iOldWnd\_cy = 0, iOldWnd\_cx = 0; int iNewCurRow\_cy = 0; static int iZaehler = 0; static CString a, b, c, d; iZaehler++; if (iZaehler == 1) { iOldWnd\_cy = cy; a.Format("%02d",iOldWnd\_cy); b.Format("%02d",cy); c.Format("%02d",iCurRow\_cy); d.Format("%02d",iNewCurRow\_cy); MessageBox("iOldWnd\_cy: "+ a + "\\ncy: " + b + "\\niCurRow\_cy: " + c + "\\niNewCurRow\_cy: " + d,"in: iZaehler == 1 " ,MB\_OK); } if ((nType == SIZE\_MAXIMIZED)) { m\_Splitter\_Main.GetRowInfo(0 ,iCurRow\_cy, iMin\_cy); iNewCurRow\_cy = (int)ResizeSplitter(cx, cy, iOldWnd\_cx, iOldWnd\_cy, iCurRow\_cy, 1); a.Format("%02d",iOldWnd\_cy); b.Format("%02d",cy); c.Format("%02d",iCurRow\_cy); d.Format("%02d",iNewCurRow\_cy); MessageBox("iOldWnd\_cy: "+ a + "\\ncy: " + b + "\\niCurRow\_cy: " + c + "\\niNewCurRow\_cy: " + d,"in: SIZE\_MAXIMIZED " ,MB\_OK); m\_Splitter\_Main.SetRowInfo(0, iNewCurRow\_cy , 0); // m\_Splitter\_Main.SetRowInfo(1, spRect.Height()/4, 0); // m\_Splitter\_Main.SetRowInfo(2, spRect.Height()/4, 0); // m\_Splitter\_Main.SetRowInfo(3, spRect.Height()/4, 0); m\_Splitter\_Main.RecalcLayout(); } else if((!m\_Splitter\_Main.m\_hWnd && nType == SIZE\_RESTORED)) { m\_Splitter\_Main.GetRowInfo(0 ,iCurRow\_cy, iMin\_cy); iNewCurRow\_cy = (int)ResizeSplitter(cx, cy, iOldWnd\_cx, iOldWnd\_cy, iCurRow\_cy, (1)); a.Format("%02d",iOldWnd\_cy); b.Format("%02d",cy); c.Format("%02d",iCurRow\_cy); d.Format("%02d",iNewCurRow\_cy); MessageBox("iOldWnd\_cy: "+ a + "\\ncy: " + b + "\\niCurRow\_cy: " + c + "\\niNewCurRow\_cy: " + d,"in: SIZE\_RESTORED " ,MB\_OK); m\_Splitter\_Main.SetRowInfo(0, iNewCurRow\_cy , 0); m\_Splitter\_Main.RecalcLayout(); }
CFrameWnd::OnSize(nType, cx, cy);
}
double CMainFrame::ResizeSplitter(int cx, int cy, int iOldWnd_cx, int iOldWnd_cy, int iCurRow_cy, int i
-
Hi;), i have a Sdi with a splitter (4 rows). When i click on the maximize button the window is maximized and the 1. splitter row changes its height proportionally ;) , but when i try to restore, nothing happens with the Splitter ;(. Please help me ! Here is my code:
/************************************************************************/
/* Resizen des Splitters */
/************************************************************************/
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{int iCurRow\_cy = 0, iMin\_cy = 0; static int iOldWnd\_cy = 0, iOldWnd\_cx = 0; int iNewCurRow\_cy = 0; static int iZaehler = 0; static CString a, b, c, d; iZaehler++; if (iZaehler == 1) { iOldWnd\_cy = cy; a.Format("%02d",iOldWnd\_cy); b.Format("%02d",cy); c.Format("%02d",iCurRow\_cy); d.Format("%02d",iNewCurRow\_cy); MessageBox("iOldWnd\_cy: "+ a + "\\ncy: " + b + "\\niCurRow\_cy: " + c + "\\niNewCurRow\_cy: " + d,"in: iZaehler == 1 " ,MB\_OK); } if ((nType == SIZE\_MAXIMIZED)) { m\_Splitter\_Main.GetRowInfo(0 ,iCurRow\_cy, iMin\_cy); iNewCurRow\_cy = (int)ResizeSplitter(cx, cy, iOldWnd\_cx, iOldWnd\_cy, iCurRow\_cy, 1); a.Format("%02d",iOldWnd\_cy); b.Format("%02d",cy); c.Format("%02d",iCurRow\_cy); d.Format("%02d",iNewCurRow\_cy); MessageBox("iOldWnd\_cy: "+ a + "\\ncy: " + b + "\\niCurRow\_cy: " + c + "\\niNewCurRow\_cy: " + d,"in: SIZE\_MAXIMIZED " ,MB\_OK); m\_Splitter\_Main.SetRowInfo(0, iNewCurRow\_cy , 0); // m\_Splitter\_Main.SetRowInfo(1, spRect.Height()/4, 0); // m\_Splitter\_Main.SetRowInfo(2, spRect.Height()/4, 0); // m\_Splitter\_Main.SetRowInfo(3, spRect.Height()/4, 0); m\_Splitter\_Main.RecalcLayout(); } else if((!m\_Splitter\_Main.m\_hWnd && nType == SIZE\_RESTORED)) { m\_Splitter\_Main.GetRowInfo(0 ,iCurRow\_cy, iMin\_cy); iNewCurRow\_cy = (int)ResizeSplitter(cx, cy, iOldWnd\_cx, iOldWnd\_cy, iCurRow\_cy, (1)); a.Format("%02d",iOldWnd\_cy); b.Format("%02d",cy); c.Format("%02d",iCurRow\_cy); d.Format("%02d",iNewCurRow\_cy); MessageBox("iOldWnd\_cy: "+ a + "\\ncy: " + b + "\\niCurRow\_cy: " + c + "\\niNewCurRow\_cy: " + d,"in: SIZE\_RESTORED " ,MB\_OK); m\_Splitter\_Main.SetRowInfo(0, iNewCurRow\_cy , 0); m\_Splitter\_Main.RecalcLayout(); }
CFrameWnd::OnSize(nType, cx, cy);
}
double CMainFrame::ResizeSplitter(int cx, int cy, int iOldWnd_cx, int iOldWnd_cy, int iCurRow_cy, int i
Wrong board Croc! :) Visual C++/MFC[^]
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Wrong board Croc! :) Visual C++/MFC[^]
Mark Salsbery Microsoft MVP - Visual C++ :java:
Oh sorry ;) Croc