Ok here's my first snippet of code:
BOOL fRet = FALSE;
CRect cr;
GetWindowRect(&cr);
if(!m_wndSplit.CreateStatic(this, 2, 1, WS_CHILD | WS_VISIBLE, AFX_IDW_PANE_FIRST))
goto bail;
m_wndSplit.SetRowInfo(0, 13*(cr.Height())/16, 10);
m_wndSplit.SetRowInfo(1, 3*(cr.Height())/16, 10);
if(!m_wndSplit.CreateView(1, 0, RUNTIME_CLASS(CDirCmdView), CSize(0, cr.Height()/2), pContext))
goto bail;
if(!m_wndSplit2.CreateStatic(&m_wndSplit, 1, 2, WS_CHILD | WS_VISIBLE | WS_BORDER, m_wndSplit.IdFromRowCol(0, 0)))
goto bail;
if(!m_wndSplit2.CreateView(0, 0, RUNTIME_CLASS(CMapView), CSize(cr.Width()/2, cr.Height()/2), pContext))
goto bail;
m_wndSplit2.SetColumnInfo(0, 7*(cr.Width())/8, 10);
if(!m_wndSplit2.CreateView(0, 1, RUNTIME_CLASS(CStatusView), CSize(cr.Width()/2, cr.Height()/2), pContext))
goto bail;
m_wndSplit2.SetColumnInfo(1, cr.Width()/8, 10);
m_wndSplit.RecalcLayout();
m_wndSplit2.RecalcLayout();
fRet = TRUE;
bail:
return fRet;
This works peachy until I add the OnSize message handler, and add this code:
CRect cr;
GetWindowRect(&cr);
m_wndSplit.SetRowInfo(0, 13*(cr.Height())/16, 10);
m_wndSplit.SetRowInfo(1, 3*(cr.Height())/16, 10);
m_wndSplit2.SetColumnInfo(0, 7*(cr.Width())/8, 10);
m_wndSplit2.SetColumnInfo(1, cr.Width()/8, 10);
m_wndSplit.RecalcLayout();
m_wndSplit2.RecalcLayout();
Then I get an access violation error on the very first CreateStatic function. What gives? All I want to do is take my top portion of code, and make it so whenever the window is resize that the aspect ratio of all the childviews stays the same...
Thanks in advance.