mfc splitter view sizing

This is a discussion on mfc splitter view sizing within the Windows Programming forums, part of the Platform Specific Boards category; I have attached a picture of what I'm getting when the window is created ( http://imagebin.org/41999 ) as well as ...

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    222

    mfc splitter view sizing

    I have attached a picture of what I'm getting when the window is created (http://imagebin.org/41999) as well as the picture of what I want the window to initialize the views (http://imagebin.org/42000). However, I have had some trouble acquiring the appropriate client rectangle to size it properly. Below is my OnCreateClient function that is responsible for creating the splitter views. It would be great to hear what I'm doing inappropriately with the sizing. Thanks in advance.

    Code:
    BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
    								CCreateContext* pContext)
    {
    
    	AllocConsole();			// console for debugging
    	freopen("CONOUT$", "wb", stdout);
    
    	if(!m_subwndSplitter.CreateStatic(this, 2, 1))
    		return FALSE;
    	CRect rect;
    	GetClientRect(&rect);
    	if(!m_subwndSplitter.CreateView(1, 0, RUNTIME_CLASS(NeedleInsertControl), CSize(rect.Width(), 50),	pContext))
    		return FALSE;
    
    	if (!m_wndSplitter.CreateStatic(&m_subwndSplitter, 1, 2, WS_CHILD | WS_VISIBLE | WS_BORDER, m_subwndSplitter.IdFromRowCol(0,0)))
    	{
    		AfxMessageBox(_T("Splitter window cannot be created"));
    		return FALSE;
    	}
    
    	// first pane
    	if(!m_wndSplitter.CreateView(0, 0, 	RUNTIME_CLASS(CsplitterView), CSize(rect.Width()/5,rect.Height()-50), pContext)) 
    	{
    		AfxMessageBox( "Error setting up splitter frames!"); 
    		return FALSE; 
    	}
    
    	//Second pane
    	if(!m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(dummyview), CSize(rect.Width()-rect.Width()/5,rect.Height()-50), pContext))
    	{
    		AfxMessageBox( "Error setting up splitter frames!"); 
    		return FALSE;
    	} 
    
    	return TRUE;
    }

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    I don't often use splitters so not 100%....

    The height of the toolbar is included in the client rect and is about 50 in height, which is why the first splitter appears just under the toolbar.

    Rows are down, columns across.

    Try
    Code:
    if(!m_subwndSplitter.CreateView(1, 0, RUNTIME_CLASS(NeedleInsertControl), CSize(rect.Width(), rect.Height()/2)),	pContext))
    		return FALSE;
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    Registered User
    Join Date
    Jul 2004
    Posts
    222
    Tried it. Didn't quite do it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Access a Specific View in MainFrame :: MFC
    By kuphryn in forum Windows Programming
    Replies: 1
    Last Post: 01-07-2011, 09:06 AM
  2. WIndows programming?
    By hostensteffa in forum Windows Programming
    Replies: 7
    Last Post: 06-07-2002, 09:52 PM
  3. Set View Position in CEditView :: MFC
    By kuphryn in forum Windows Programming
    Replies: 1
    Last Post: 05-21-2002, 10:27 PM
  4. Determining Active View :: MFC
    By kuphryn in forum Windows Programming
    Replies: 0
    Last Post: 04-25-2002, 08:34 PM
  5. How to open two view i MFC
    By Unregistered in forum Windows Programming
    Replies: 0
    Last Post: 02-05-2002, 04:13 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21