1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

splitter problem

Discussion in 'MFC' started by answerme, Jun 29, 2009.

  1. answerme

    answerme New Member

    Joined:
    Dec 17, 2007
    Messages:
    114
    Likes Received:
    0
    Trophy Points:
    0
    hi iam facing a debug problem .This is because of splitter only .I am having One row & 2 columns.But when iam running my program it is giving me runtime error ie
    DEBUG ASSERTION FAILED from c:...../mfc/winsplitt.cpp

    Problem where iam facing i have marked it with bold in below code

    Code:
    BOOL CSplitter_Main::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
    {
    	if(!m_wndSplitter.CreateStatic(this, 2, 1)) //,			// TODO: adjust the number of rows, columns
    	{
    		return FALSE ;
    	}
    	
        if (!m_wndSplitter.CreateView(0, 0,	RUNTIME_CLASS(CEntityTreeView), CSize(170, 550), pContext))
    	{
    		TRACE0("Failed to create second pane\n");
    		return FALSE;
    	}
    	
    	// add the second splitter pane - the default view  in row 1
        if (!m_wndSplitter.CreateView(0, 1,	RUNTIME_CLASS(CScenGenView), CSize(150,550), pContext))
    	{
    		TRACE0("Failed to create first pane\n");
    		return FALSE;
    	}
    	m_wndSplitter1.CreateStatic(&m_wndSplitter, 2,1 , WS_CHILD|WS_VISIBLE|WS_BORDER|WS_MAXIMIZE, AFX_IDW_PANE_FIRST ) ;
    
    	// add the first splitter pane - an input view in row 0
       [B] if (!m_wndSplitter1.CreateView(0,0,	RUNTIME_CLASS(CEntityListView),	CSize(150,550), pContext))
    	{
    		TRACE0("Failed to create first pane\n");
    		return FALSE;
    	}[/B]
    	SetActiveView((CView*)m_wndSplitter.GetPane(0,1));
    
    	return TRUE;
    }
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,292
    Likes Received:
    365
    Trophy Points:
    83
    Looks difficult to understand but it looks like the issue may be with pContext
     
  3. answerme

    answerme New Member

    Joined:
    Dec 17, 2007
    Messages:
    114
    Likes Received:
    0
    Trophy Points:
    0
    Hi I am able to rectify the problem . But now I am facing one more problem ,My values are not getting updated properly in my mfc application .I meant on my window values are getting updated only when iam minimizing my window screen or seeing other application & then coming back to my mfc application .I tried Invalidate & invalidateRect also but still facing same problem
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,292
    Likes Received:
    365
    Trophy Points:
    83
    Use the InvalidateRect to repaint the needed region
     
  5. answerme

    answerme New Member

    Joined:
    Dec 17, 2007
    Messages:
    114
    Likes Received:
    0
    Trophy Points:
    0
    HI Again
    Updation is happening properly now . But mySplitter which is divided into 1 row & 2 column ,2nd column is facing problem .Whenever iam running my mfc application, 2nd column is showing the background of the desktop,or if my application code is behind it is displaying that.When iam adjusting other pane then its coming alright . Do u have any solution
     
  6. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,292
    Likes Received:
    365
    Trophy Points:
    83
    Yes, Invalidate that area as well at the startup
     
  7. answerme

    answerme New Member

    Joined:
    Dec 17, 2007
    Messages:
    114
    Likes Received:
    0
    Trophy Points:
    0
    Ya i tried Invalidate but it is not happening ,one thing i Observed that

    if(!m_wndSplitter1.CreateView(1,0,RUNTIME_CLASS(CEntityListView),CSize(0,100),pContext))

    the size specified in CSize() is not having any effect ,is it because of this
     
  8. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,292
    Likes Received:
    365
    Trophy Points:
    83
    Does the Area get corrected if you Min and Max the window ?
     
  9. answerme

    answerme New Member

    Joined:
    Dec 17, 2007
    Messages:
    114
    Likes Received:
    0
    Trophy Points:
    0
    ya when i run mfc applcation & i min or max windows it is happening.But on the code size when i am specifying the CSize it is not increasing or decresing
     
  10. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,292
    Likes Received:
    365
    Trophy Points:
    83
    If it happens when you Min Max then its about repainting issue and not the problem about the size not taking effect.
     
  11. answerme

    answerme New Member

    Joined:
    Dec 17, 2007
    Messages:
    114
    Likes Received:
    0
    Trophy Points:
    0
    Then how should I solve this problem ,I have used Invalidate to the specfic region but still its creating problem
     
  12. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,292
    Likes Received:
    365
    Trophy Points:
    83
    Try Invalidating the entire window because it looks like the paint is not being called if you are invalidating it as well.
     
  13. answerme

    answerme New Member

    Joined:
    Dec 17, 2007
    Messages:
    114
    Likes Received:
    0
    Trophy Points:
    0
    Ya i tried to invalidate on main window same problem is coming as well as my CPU usage increase to 50 to 51%
     
  14. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,292
    Likes Received:
    365
    Trophy Points:
    83
    Try using OutputDebugString and see if the paint of splitter is called after you call the Invalidate.
     

Share This Page