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

}

Subscribe / Share

It's very calm over here, why not leave a comment?

Leave a Reply




Categories

Powered by Yahoo! Answers