How do I write code that allows to create a dynamic splitter at run time, i.e. when we select an option like split window through a menu?

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( ) ;

}

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>