Ans: To create a dynamic splitter, override OnCreateClient( ) and add code to it as shown below:
BOOL CMainFrame :: OnCreateClient ( LPCREATESTRUCT lpcs, CCreateContext* pContext )
{
m_dyn.Create ( this , 1 , 2 , CSize( 01 , 01 ) , pContext ) ; // where m_dyn is a member variable of type CSplitterWnd
return TRUE ;
}
Here, we have simply created a dynamic splitter window of one row two columns. Then, to the handler of menu item call DoKeyboardSplit( ) method of CSplitterWnd class as shown below:
void CMainFrame :: OnSplit( )
{
m_dyn.DoKeyboardSplit( ) ;
}