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.
Subject |
Author |
Date |
|
Offer Har
|
Jul 27, 2008 - 7:33 AM
|
|
|
Technical Support
|
Jul 28, 2008 - 12:23 PM
|
|
|
Offer Har
|
Aug 3, 2008 - 4:20 PM
|
|
|
Technical Support
|
Aug 5, 2008 - 12:49 PM
|
Dear Ron,
We cannot reproduce the problem with item hiding and removing. Wherever we call the following code in the method of the CExtTreeGridWnd -derived class it does not crash:
HTREEITEM htiTop1 = ItemInsert( NULL, ULONG(-1L), 1L, false ); ItemExpand( htiTop1, TVE_EXPAND, false );
HTREEITEM htiChild1ofTop1 = ItemInsert( htiTop1, ULONG(-1L), 1L, false );
HTREEITEM htiChild2ofTop1 = ItemInsert( htiTop1, ULONG(-1L), 1L, false );
HTREEITEM htiTop2 = ItemInsert( NULL, ULONG(-1L), 1L, false ); ItemExpand( htiTop2, TVE_EXPAND, false );
HTREEITEM htiChild1ofTop2 = ItemInsert( htiTop2, ULONG(-1L), 1L, false );
HTREEITEM htiChild2ofTop2 = ItemInsert( htiTop2, ULONG(-1L), 1L, false );
ItemHide( htiTop1, true, false );
ItemRemove(htiChild1ofTop1, false, false);
ItemRemove(htiChild2ofTop1, false, false);
OnSwUpdateScrollBars();
|
|
Offer Har
|
Aug 5, 2008 - 12:54 PM
|
Sent - please let me know you got it or not...
|
|
Technical Support
|
Aug 5, 2008 - 2:21 PM
|
Dear Ron,
Your test project really helped us to find and fix the bug with removing tree rows at the bottom of some hidden tree rows. Thank you. Please update the source code for the following method:
ULONG CExtTreeGridDataProvider::_Tree_NodeRemove(
CExtTreeGridCellNode * pNode,
bool bChildrenOnly // = false
) // returns count of removed items
{
ASSERT_VALID( this );
ASSERT_VALID( pNode );
ASSERT_VALID( m_pCellRoot );
CExtGridDataProvider & _DP = _Tree_GetCacheDP();
ULONG nReservedRowCount = 0;
_DP.CacheReservedCountsGet( NULL, &nReservedRowCount );
ULONG nAdjustOffset = 1;
if( LPVOID(pNode) == LPVOID(m_pCellRoot) )
{
bChildrenOnly = true;
nAdjustOffset = 0;
}
bool bNodeIsHidden = pNode->TreeNodeHiddenGet();
if( bNodeIsHidden )
pNode->TreeNodeHiddenSet( *this, false );
ULONG nCountRemoved = 0,
nIdx,
nChildrenCount = pNode->TreeNodeGetChildCount();
for( nIdx = 0; nIdx < nChildrenCount; nIdx++ )
{
CExtTreeGridCellNode * pChildNode = pNode->TreeNodeGetChildAt( nIdx );
ASSERT_VALID( pChildNode );
ULONG nSubCountRemoved = _Tree_NodeRemove( pChildNode, true );
nCountRemoved += nSubCountRemoved;
}
ULONG nContentWeight = pNode->_ContentWeight_Get( false );
ULONG nOffset = pNode->TreeNodeCalcOffset( false );
bool bDisplayed = pNode->TreeNodeIsDisplayed();
bool bExpanded = pNode->TreeNodeIsExpanded();
ULONG nVisibleOffset = 0;
if( bDisplayed )
nVisibleOffset = pNode->TreeNodeCalcOffset( true, false );
if( nContentWeight > 0 )
{
m_arrGridRef.RemoveAt( nOffset + nAdjustOffset, nContentWeight );
if( bDisplayed && bExpanded )
{
#ifdef _DEBUG
if( LPVOID(pNode) != LPVOID(m_pCellRoot) )
{
CExtTreeGridCellNode * pDebugTestNode = m_arrGridVis.GetAt( nVisibleOffset );
ASSERT_VALID( pDebugTestNode );
ASSERT( LPCVOID(pDebugTestNode) == LPCVOID(pNode) );
}
#endif
ULONG nVisibleContentWeight = pNode->_ContentWeight_CalcVisible();
m_arrGridVis.RemoveAt( nVisibleOffset + nAdjustOffset, nVisibleContentWeight );
pNode->_ContentWeight_Decrement( nVisibleContentWeight, false );
pNode->m_arrChildren.RemoveAll();
}
else
{
pNode->m_arrChildren.RemoveAll();
pNode->_ContentWeight_DecrementNonExpanded( nContentWeight );
pNode->_ContentWeight_Adjust();
}
ASSERT( pNode->_ContentWeight_Get(true) == 0 );
ASSERT( pNode->_ContentWeight_Get(false) == 0 );
nCountRemoved += nContentWeight;
VERIFY( _DP.RowRemove( nOffset + nAdjustOffset + nReservedRowCount, nContentWeight ) );
}
if( ! bChildrenOnly )
{
CExtTreeGridCellNode * pNodeNext = pNode->m_pNodeNext;
CExtTreeGridCellNode * pNodePrev = pNode->m_pNodePrev;
CExtTreeGridCellNode * pNodeParent = pNode->m_pNodeParent;
ASSERT_VALID( pNodeParent );
ULONG nSiblingIdx = pNode->TreeNodeGetSiblingIndex();
if( pNodeNext != NULL )
{
ASSERT_VALID( pNodeNext );
ASSERT( LPCVOID(pNodeNext->m_pNodePrev) == LPCVOID(pNode) );
pNodeNext->m_pNodePrev = pNodePrev;
}
if( pNodePrev != NULL )
{
ASSERT_VALID( pNodePrev );
ASSERT( LPCVOID(pNodePrev->m_pNodeNext) == LPCVOID(pNode) );
pNodePrev->m_pNodeNext = pNodeNext;
}
pNodeParent->m_arrChildren.RemoveAt( nSiblingIdx );
ULONG nResetIdx = nSiblingIdx, nResetCnt = ULONG( pNodeParent->m_arrChildren.GetSize() );
for( ; nResetIdx < nResetCnt; nResetIdx++ )
{
CExtTreeGridCellNode * pNode = (CExtTreeGridCellNode *)
pNodeParent->m_arrChildren.GetAt( nResetIdx );
ASSERT_VALID( pNode );
ASSERT_KINDOF( CExtTreeGridCellNode, pNode );
pNode->m_nOptIndex = nResetIdx;
}
if( bDisplayed )
{
#ifdef _DEBUG
if( LPVOID(pNode) != LPVOID(m_pCellRoot) )
{
CExtTreeGridCellNode * pDebugTestNode = m_arrGridVis.GetAt( nVisibleOffset );
ASSERT_VALID( pDebugTestNode );
ASSERT( LPCVOID(pDebugTestNode) == LPCVOID(pNode) );
}
#endif
m_arrGridVis.RemoveAt( nVisibleOffset );
pNodeParent->_ContentWeight_Decrement( 1, false );
}
else
{
pNodeParent->_ContentWeight_DecrementNonExpanded( 1 );
pNodeParent->_ContentWeight_Adjust();
}
VERIFY( _DP.RowRemove( nOffset + nReservedRowCount ) );
}
return nCountRemoved;
}
|
|
Offer Har
|
Aug 5, 2008 - 12:52 PM
|
Dear Support, I am sending you now via mail an application that demonstrates the bug. Please let me know when you get it and that you were able to reproude the bug. Regards, Ron.
|
|
Offer Har
|
Jul 28, 2008 - 12:26 PM
|
I sent you an exact scenario when this bug happens.
|
|