|
|
|
|
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 |
|
Christophe Guibert
|
Aug 5, 2006 - 10:02 AM
|
Hello,
While using the CExtReportGridWnd in my application, I think I found a bug that can also simply be produced with your ReportGrid sample.
1. Launch the ReportGrid sample (compiled in static unicode debug) 2. Drag / drop the "Name" column header in the "group by" box 3. Scroll down the window and expand the last item (named "LL mountain frame - silver 52") 4. Select the four last subitems (leaving one), and destroy them with the Delete key 5. Select the last remaining subitem, and destroy it. 6. ASSERT failure in the CExtTreeGridCellNode::FromHTREEITEM method (and crash in the release mode).
This appens only in the last group.
I also encounter the same behavior (same bug ?) when unregistering all the rows of a CExtReportGridWnd instance where rows have been grouped.
Would you mind providing a fix, please ? (However, I am not stuck since I can temporarily disable the "group by" feature).
Good luck in the debug, and thanks in advance.
Best Regards,
Christophe Guibert
|
|
Technical Support
|
Aug 7, 2006 - 9:05 AM
|
Thank you for reporting the bug. You can fix it by updating the source code for the CExtReportGridWnd::ReportItemUnRegisterSelection() method: bool CExtReportGridWnd::ReportItemUnRegisterSelection(
bool bRedraw
)
{
ASSERT_VALID( this );
if( SelectionIsEmpty()
|| RowCountGet() == 0
|| ColumnCountGet() == 0
)
return false;
HTREEITEM htiNewFocus = NULL;
if( ! ReportItemModifySelectionForUnRegistering( false, &htiNewFocus ) )
return false;
m_nHelerLockOnSwUpdateScrollBars ++;
m_nHelerLockEnsureVisibleColumn ++;
m_nHelerLockEnsureVisibleRow ++;
CTypedPtrList < CPtrList, CExtReportGridItem * > _listToRemove;
LONG nRowNo = SelectionGetFirstRowInColumn( 0 );
for( ; nRowNo >= 0; )
{
HTREEITEM hTreeItem = ItemGetByVisibleRowIndex( nRowNo );
ASSERT( hTreeItem != NULL );
CExtReportGridItem * pRGI = ReportItemFromTreeItem( hTreeItem );
ASSERT_VALID( pRGI );
_listToRemove.AddHead( pRGI );
if( ItemGetChildCount( hTreeItem ) == 0 )
nRowNo = SelectionGetNextRowInColumn( 0, nRowNo );
else
{
hTreeItem = ItemGetNext( hTreeItem, false, true, false );
if( hTreeItem == NULL )
break;
nRowNo = ItemGetVisibleIndexOf( hTreeItem );
ASSERT( nRowNo > 0 );
nRowNo = SelectionGetNextRowInColumn( 0, nRowNo - 1 );
}
}
SelectionUnset( false, false );
LONG nRowEnsureVisible = -1L;
if( htiNewFocus != NULL )
{
nRowEnsureVisible = ItemGetVisibleIndexOf( htiNewFocus );
ASSERT( nRowEnsureVisible >= 0 );
}
POSITION pos = _listToRemove.GetHeadPosition();
for( ; pos != NULL; )
{
CExtReportGridItem * pRGI = _listToRemove.GetNext( pos );
_ReportItemUnRegisterImpl( pRGI, false, false );
}
m_nHelerLockOnSwUpdateScrollBars --;
m_nHelerLockEnsureVisibleColumn --;
m_nHelerLockEnsureVisibleRow --;
if( htiNewFocus != NULL )
{
LONG nNewRowCount = RowCountGet();
if( nNewRowCount > 0 )
{
if( nRowEnsureVisible < nNewRowCount )
{
nRowEnsureVisible = ItemGetVisibleIndexOf( htiNewFocus );
ASSERT( nRowEnsureVisible >= 0 );
ItemFocusSet( htiNewFocus, false );
}
else
{
nRowEnsureVisible = nNewRowCount - 1L;
htiNewFocus = ItemGetByVisibleRowIndex( nRowEnsureVisible );
ASSERT( htiNewFocus != NULL );
ItemFocusSet( htiNewFocus, false );
}
}
else
nRowEnsureVisible = -1L;
}
else if( RowCountGet() > 0 )
{
nRowEnsureVisible = 0;
FocusSet( CPoint( FocusGet().x, nRowEnsureVisible ), false, false, true, false );
}
if( bRedraw && GetSafeHwnd() != NULL )
{
OnSwUpdateScrollBars();
if( nRowEnsureVisible >= 0L )
EnsureVisibleRow( nRowEnsureVisible, true );
else
OnSwDoRedraw();
}
return true;
}
|
|
Christophe Guibert
|
Aug 8, 2006 - 4:03 AM
|
Hello,
Thank you for the fix. It solves both problems, in the ReportGrid sample and in my application.
Best Regards,
Christophe Guibert
|
|