Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have splitter window with 3 views as shown in fig below!
----------------
|
FrmView |FrmView
|
----------------
EditView
----------------


when i click to resize the mainframe at the bottom right,left or on top, the other 2 splitter view dissapers keeping only one main view which is associated with CDocTemplate! The code which i used to create Splitter window is as follows:

CEditUserInput: derived from CEditView.
CFormQuestion: derived from CFormView.
CFormOutput: derived from CFormView.


BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
    	// TODO: Add your specialized code here and/or call the base class
    
    	    // create splitter window
    	    if (!m_wndSplitter.CreateStatic(this, 2, 1))
    		return FALSE;
    
    		CRect rect; 
            GetWindowRect(rect); 
    
    		if (!m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CEditUserInput),                                               CSize(0,0), pContext))
    		{
    			//m_wndSplitter.DestroyWindow();
    			return FALSE;
    		}		
    
    		
    		int nHt = rect.Height();
    		int nWd = rect. Width( ); 
    
    
    		m_wndSplitter.SetRowInfo(0, (nHt/2)+50,10);
    		m_wndSplitter.SetRowInfo(1, (nHt/2)-50,10);
    
    
    		//Second: split the 1st row into 2 columns. 
    		if (!m_secondSplitter.CreateStatic(&m_wndSplitter,1,2, 
    		WS_CHILD|WS_VISIBLE|WS_BORDER, 
    		m_wndSplitter.IdFromRowCol(0,0))) 
    
    		{ 
    		  return false; 
    		} 
    
    
    		if (!m_secondSplitter.CreateView(0,0,RUNTIME_CLASS(CFormQuestion), 
    		 CSize(0,0), pContext )) 
    		{ 
    		return false; 
    		} 
    
    		if (!m_secondSplitter.CreateView(0,1,RUNTIME_CLASS(CFormOutput), 
    		 CSize(0,0), pContext )) 
    		{ 
    		return false; 
    		} 
    
    		m_secondSplitter.SetColumnInfo(0,nWd/2,10); 
    
    		
    		 //Set the splitter check variable to true
    		 m_checkSplitterWnd = true;
    		
    	    return CFrameWndEx::OnCreateClient(lpcs, pContext);
    
} 

DocTemplate Code:

VB
// Register the application's document templates.  Document templates
    //  serve as the connection between documents, frame windows and views
    CSingleDocTemplate* pDocTemplate;

    pDocTemplate = new CSingleDocTemplate(
        IDR_MAINFRAME,
        RUNTIME_CLASS(CPrajaktaDoc),
        RUNTIME_CLASS(CMainFrame),       // main SDI frame window
        RUNTIME_CLASS(CFormQuestion));
Posted
Updated 2-Jan-13 20:21pm
v7

1 solution

This isn't a complete solution but I think you'll find that the other 2 windows didn't disappear. The border on the top is probably double thickness and you can click/drag the 2 CFormView windows back into view.

I've done a lot of split window stuff in a previous lifetime and had some trouble with resizing; but it is too long ago to recall all the holes to fall into. One thing I recall is that there were 2 sets of examples, one using CSplitterWnd as main window with "has-a" and one "is-a" and there were complications with each.

An article here[^] might have some direction for you.

I assume you have read the CP article here[^]
 
Share this answer
 
Comments
shetkarabhijeet 3-Jan-13 7:51am    
Thanks for your kind reply sir!I checked it on border and tried to click and drag but it is not present over there.The other 2 views gets completely hidden keeping only one main docTemplate view! the same problem happens if i check or un check CMFCRibbon bar too!
H.Brydon 3-Jan-13 11:00am    
Have a look at the code examples and note the border settings (on the window resource) on each of the window settings.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900