![]() |
Bug in CXTSplitterWnd |
Post Reply ![]() |
Author | |
SunMarc ![]() Newbie ![]() ![]() Joined: 19 October 2006 Location: France Status: Offline Points: 13 |
![]() ![]() ![]() ![]() ![]() Posted: 02 November 2006 at 5:25am |
Hello,
I was using a CXTSplitterWnd in my App with the XTP 9.7 and all worked fine. I'm now using the 1030 and my App crashes if: I hide the 1st row I hide the 1st column I show the 1st row I show the 1st column => Assert in : BOOL CWnd::ShowWindow(int nCmdShow) { ASSERT(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL)); if (m_pCtrlSite == NULL) return ::ShowWindow(m_hWnd, nCmdShow); else return m_pCtrlSite->ShowWindow(nCmdShow); } I tried with the SplitterWindow sample and I get the same pb!! The code has been modified in the CXTSplitterWnd::ShowRow() method since the 9.7 version... any idea? Thanks. |
|
![]() |
|
SunMarc ![]() Newbie ![]() ![]() Joined: 19 October 2006 Location: France Status: Offline Points: 13 |
![]() ![]() ![]() ![]() ![]() |
I tried to replace the CXTSplitterWnd::ShowRow() and CXTSplitterWnd::HideRow() methods in the XTP 1030
with the same methods in the XTP 9.7. I recompiled XTP 1030 project and the pb is fixed... If it can help, here is the 1030 and 9.7 code for these methods: 1030 : ==== void CXTSplitterWnd::ShowRow() { ASSERT_VALID(this); if (m_nRows == m_nMaxRows && m_nHiddenRow == -1) { return; } ASSERT(m_nHiddenRow != -1); int nShowRow = m_nHiddenRow; m_nHiddenRow = -1; int cyNew = m_pRowInfo[m_nRows].nCurSize; m_nRows++; // add a nRow ASSERT(m_nRows == m_nMaxRows); int nRow; // Show the hidden nRow int nCol; for (nCol = 0; nCol < m_nCols; ++nCol) { CWnd* pPaneShow = GetDlgItem(AFX_IDW_PANE_FIRST + m_nRows * 16 + nCol); ASSERT(pPaneShow != NULL); pPaneShow->ShowWindow(SW_SHOWNA); for (nRow = m_nRows - 2; nRow >= nShowRow; --nRow) { CWnd* pPane = GetPane(nRow, nCol); ASSERT(pPane != NULL); pPane->SetDlgCtrlID(IdFromRowCol(nRow + 1, nCol)); } pPaneShow->SetDlgCtrlID(IdFromRowCol(nShowRow, nCol)); } // new panes have been created -- recalculate layout for (nRow = nShowRow + 1; nRow < m_nRows; nRow++) m_pRowInfo[nRow].nIdealSize = m_pRowInfo[nRow - 1].nCurSize; m_pRowInfo[nShowRow].nIdealSize = cyNew; RecalcLayout(); } void CXTSplitterWnd::HideRow(int nRowHide) { ASSERT_VALID(this); if (m_nHiddenRow != -1) { // return if the requested one is hidden if (m_nHiddenRow == nRowHide) { return; } ShowRow(); } ASSERT(m_nRows > 1); ASSERT(nRowHide < m_nRows); ASSERT(m_nHiddenRow == -1); m_nHiddenRow = nRowHide; int nActiveRow, nActiveCol; // if the nRow has an active window -- change it if (GetActivePane(&nActiveRow, &nActiveCol) != NULL) { if (nActiveRow == nRowHide) { if (++nActiveRow >= m_nRows) nActiveRow = 0; SetActivePane(nActiveRow, nActiveCol); } } // hide all nRow panes. int nCol; for (nCol = 0; nCol < m_nCols; ++nCol) { CWnd* pPaneHide = GetPane(nRowHide, nCol); ASSERT(pPaneHide != NULL); pPaneHide->ShowWindow(SW_HIDE); pPaneHide->SetDlgCtrlID(AFX_IDW_PANE_FIRST + m_nRows * 16 + nCol); int nRow; for (nRow = nRowHide + 1; nRow < m_nRows; ++nRow) { CWnd* pPane = GetPane(nRow, nCol); ASSERT(pPane != NULL); pPane->SetDlgCtrlID(IdFromRowCol(nRow-1, nCol)); } } m_nRows--; m_pRowInfo[m_nRows].nCurSize = m_pRowInfo[nRowHide].nCurSize; RecalcLayout(); } 9.7 : === void CXTSplitterWnd::ShowRow() { ASSERT_VALID( this ); if ( m_nRows == m_nMaxRows && m_nHiddenRow == -1) { return; } ASSERT( m_nHiddenRow != -1 ); int nShowRow = m_nHiddenRow; m_nHiddenRow = -1; int cyNew = m_pRowInfo[m_nRows].nCurSize; m_nRows++; // add a nRow ASSERT( m_nRows == m_nMaxRows ); int nRow; // Show the hidden nRow int nCol; for ( nCol = 0; nCol < m_nCols; ++nCol ) { CWnd* pPaneShow = GetDlgItem( AFX_IDW_PANE_FIRST + nCol * 16 + m_nRows ); ASSERT( pPaneShow != NULL ); pPaneShow->ShowWindow( SW_SHOWNA ); for ( nRow = m_nRows - 2; nRow >= nShowRow; --nRow ) { CWnd* pPane = GetPane( nRow, nCol ); ASSERT( pPane != NULL ); pPane->SetDlgCtrlID( IdFromRowCol( nRow + 1, nCol )); } pPaneShow->SetDlgCtrlID( IdFromRowCol( nShowRow, nCol )); } // new panes have been created -- recalculate layout for ( nRow = nShowRow+1; nRow < m_nRows; nRow++ ) m_pRowInfo[nRow].nIdealSize = m_pRowInfo[nRow - 1].nCurSize; m_pRowInfo[nShowRow].nIdealSize = cyNew; RecalcLayout(); } void CXTSplitterWnd::HideRow(int nRowHide) { ASSERT_VALID( this ); if (m_nHiddenRow != -1) { // return if the requested one is hidden if (m_nHiddenRow == nRowHide) { return; } ShowRow(); } ASSERT( m_nRows > 1 ); ASSERT( nRowHide < m_nRows ); ASSERT( m_nHiddenRow == -1 ); m_nHiddenRow = nRowHide; int nActiveRow, nActiveCol; // if the nRow has an active window -- change it if( GetActivePane( &nActiveRow, &nActiveCol ) != NULL ) { if( nActiveRow == nRowHide ) { if( ++nActiveRow >= m_nRows ) nActiveRow = 0; SetActivePane( nActiveRow, nActiveCol ); } } // hide all nRow panes. int nCol; for ( nCol = 0; nCol < m_nCols; ++nCol ) { CWnd* pPaneHide = GetPane( nRowHide, nCol ); ASSERT( pPaneHide != NULL ); pPaneHide->ShowWindow( SW_HIDE ); pPaneHide->SetDlgCtrlID( AFX_IDW_PANE_FIRST + nCol * 16 + m_nRows ); int nRow; for ( nRow = nRowHide+1; nRow < m_nRows; ++nRow ) { CWnd* pPane = GetPane( nRow, nCol ); ASSERT( pPane != NULL ); pPane->SetDlgCtrlID( IdFromRowCol( nRow-1, nCol )); } } m_nRows--; m_pRowInfo[m_nRows].nCurSize = m_pRowInfo[nRowHide].nCurSize; RecalcLayout(); } |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |