CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Threaded View

  1. #3
    Join Date
    May 2002
    Posts
    1,798

    Re: Could use some help with this interface

    Thanks alot Arjay,

    This works after making some minor changes. It is somewhat confusing which panes belong to which CSplitterWnd because there is only 1 column with 2 rows and the upper right hand pane is nested within column 1 which is misleadingly associated with m_wndSplitter2 while row 2 is associated with m_wndSplitter.

    CSplitterWnd m_wndSplitter; // the bottom pane (1, 0)
    CSplitterWnd m_wndSplitter2; // the top left hand pane (0, 0) and the top right hand pane (0, 1)

    Code:
    void CChildFrame::OnSize(UINT nType, int cx, int cy)
    {
    	CMDIChildWndEx::OnSize(nType, cx, cy);
    
    	CRect cr;
    	GetWindowRect(&cr); 
    
    	if (m_bInitSplitter && nType != SIZE_MINIMIZED)
    	{
    		m_wndSplitter.SetRowInfo( 0, 0.75*cy, 0 );  // adjust row 1 height here
    		m_wndSplitter2.SetColumnInfo(0, cr.Width() / 2, 50);
    		m_wndSplitter2.SetColumnInfo(1, cr.Width()/ 2, 50); 
    		m_wndSplitter.SetColumnInfo(0, cr.Width(), 50);
    		m_wndSplitter.SetRowInfo(1, cr.Height()/4, 30);
    
    		m_wndSplitter.RecalcLayout();
    
    		DisplayViewThreeWindow();
    	}
    
    	//DisplayViewThreeWindow();   // crashes if here
    }
    
    void CChildFrame::DisplayViewThreeWindow()
    {
    	// get the debug view text
    	CString csViewThreeText;
    	TRACE0("csViewThreeText = "); OutputDebugString(csViewThreeText); TRACE0("\n");
    
    	int cx, cy;
    	CRect r;
    	GetClientRect(&r);
    
    	if(!m_bViewThree)
    	{
    		m_wndSplitter2.EnableWindow();
    		m_wndSplitter2.SetRowInfo(0, r.Height(), r.Height());
    		m_wndSplitter2.SetColumnInfo(0,r.Width()/2,0);
    		m_wndSplitter2.SetColumnInfo(1,r.Width()/2,0);
    
    		cx = r.Width();
    		cy = r.Height();
    		m_wndSplitter.EnableWindow();
    		m_wndSplitter.SetRowInfo(0,cy,30);
    		m_wndSplitter.SetColumnInfo(0,cx,30);
    
    	}
    
    	if(m_bViewThree)
    	{
    		m_wndSplitter.EnableWindow();
    		cx = r.Width();
    		cy = 0.70 * r.Height();
    		m_wndSplitter.EnableWindow();
    		m_wndSplitter.SetRowInfo(0,cy,30);
    		m_wndSplitter.SetColumnInfo(0,cx,30);
    	}
    
    	m_wndSplitter.RecalcLayout();
    
    }
    Last edited by Mike Pliam; April 11th, 2013 at 01:36 PM.
    mpliam

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured