Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » CExtSplitterWnd Assert Collapse All
Subject Author Date
David Baginski Mar 25, 2005 - 3:10 PM

After creating a new document with two panes, the ASSERT(nIndex >= 0) fires in ExtSplitterWnd.cpp. Can you give me any tips on how to track this down? I can provide more details if needed.

From ExtSplitterWnd.cpp

    if( pOneNoteTabs != NULL )
    {
        bDrawDefault = false;
        LONG nIndex = pOneNoteTabs->ItemFindByHWND( pInnerFrame->m_hWnd );
        ASSERT( nIndex >= 0 );
        CExtTabOneNoteWnd::TAB_ITEM_INFO_ONENOTE * pTII =
            pOneNoteTabs->ItemGet( nIndex );
        COLORREF clrFill = pTII->GetColorBkDark();
        pDC->FillSolidRect( rcClient, clrFill );
    } // if( pOneNoteTabs != NULL )

My code:

BOOL CChildFrame::OnCreateClient( LPCREATESTRUCT /* lpcs */,
    CCreateContext* pContext)
{
    CRect rect;
    GetClientRect(&rect);

    CSize size = rect.Size();
    size.cy /= 2;

    if (!m_wndSplitter.CreateStatic(this, 2, 1, WS_CHILD|WS_VISIBLE, AFX_IDW_PANE_FIRST))
    {
        AfxMessageBox("Unable to create spliter window.", MB_ERROR);
        return FALSE;
    }

    if (!m_wndSplitter.CreateView(ID_GRID_PANE, 0, RUNTIME_CLASS(CGridView), size, pContext))
    {
        AfxMessageBox("Unable to create grid view.", MB_ERROR);
        return FALSE;
    }
    
    if (!m_wndSplitter.CreateView(ID_CHART_PANE, 0, RUNTIME_CLASS(CChartView), size, pContext))
    {
        AfxMessageBox("Unable to create graph view.", MB_ERROR);
        return FALSE;
    }

    m_wndSplitter.RecalcLayout();    

    return TRUE;
}

David Baginski Mar 25, 2005 - 7:17 PM

This problem presents itself after a bring up a modal dialog during CMyDocument::OnNewDocument. When I open an existing document and don’t bring up the dialog, then I do not get the assert.

I went on to find that the problem occurs if I just process a message loop inside of OnNewDocument() without bringing up a dialog.

Technical Support Mar 28, 2005 - 6:04 AM

We confirm that this is a bug. To fix it, open the ExtSplitterWnd.cpp file and replace the “if” statement with the problem ASSERT macros inside with the following code:

if( pOneNoteTabs != NULL )
{
   bDrawDefault = false;
   LONG nIndex = 
 pOneNoteTabs->ItemFindByHWND( pInnerFrame->m_hWnd );
   // ASSERT( nIndex >= 0 );
   if( nIndex >= 0 )
   {
      CExtTabOneNoteWnd::TAB_ITEM_INFO_ONENOTE * pTII =
         pOneNoteTabs->ItemGet( nIndex );
      COLORREF clrFill = pTII->GetColorBkDark();
      pDC->FillSolidRect( rcClient, clrFill );
   }
} // if( pOneNoteTabs != NULL )

David Baginski Mar 28, 2005 - 7:49 AM

Thank you. That is what I did.