|
|
|
|
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 |
|
Bart Kampers
|
Jul 5, 2010 - 4:48 AM
|
Hello, I try to clear a corner cell in a CExtGridWnd by invoking GridCellSet(0, 0, NULL, 1, 1, -1, -1, false). This causes an assertion failure because of the following code in ExtGridWnd.cpp at line 53903
if( nColType < 0 )
{
if( nRowType != 0 )
{
// only one of nColType, nRowType may be non-zero
ASSERT( FALSE );
Why is it wrong for both nRowType and nColType to be non-zero?
How can I clear the corner cell?
Thanks in advance,
Bart.
|
|
Technical Support
|
Jul 5, 2010 - 12:14 PM
|
Thank you for reporting this issue. Here is the fix: bool CExtGridWnd::GridCellSet(
LONG nColNo,
LONG nRowNo,
const CExtGridCell * pCell, // = NULL // NULL - clear (make empty)
LONG nColCount, // = 1L
LONG nRowCount, // = 1L
INT nColType, // = 0 // -1 - nColNo is fixed column at left, 1 - at right, 0 - data cell
INT nRowType, // = 0 // -1 - nRowNo is fixed column at top, 1 - at bottom, 0 - data cell
bool bRedraw // = true
)
{
__EXT_DEBUG_GRID_ASSERT_VALID( this );
if( nColNo < 0L || nRowNo < 0L || nColCount < 0L || nRowCount < 0L )
{
// invalid cell position
//__EXT_DEBUG_GRID_ASSERT( FALSE );
return false;
} // if( nColNo < 0L || nRowNo < 0L || nColCount < 0L || nRowCount < 0L )
if( nColCount == 0L || nRowCount == 0L )
{
if( bRedraw )
{
OnSwUpdateScrollBars();
OnSwDoRedraw();
} // if( bRedraw )
return true;
} // if( nColCount == 0L || nRowCount == 0L )
LONG nEffectiveColNo = nColNo;
LONG nEffectiveRowNo = nRowNo;
if( nColType < 0 )
{
LONG nOuterColCountLeft = CExtGridBaseWnd::OuterColumnCountLeftGet();
if( nColNo >= nOuterColCountLeft )
{
// invalid cell position
__EXT_DEBUG_GRID_ASSERT( FALSE );
return NULL;
}
} // if( nColType < 0 )
else if( nColType > 0 )
{
LONG nOuterColCountRight = CExtGridBaseWnd::OuterColumnCountRightGet();
if( nColNo >= nOuterColCountRight )
{
// invalid cell position
__EXT_DEBUG_GRID_ASSERT( FALSE );
return NULL;
}
LONG nOuterColCountLeft = CExtGridBaseWnd::OuterColumnCountLeftGet();
nEffectiveColNo += nOuterColCountLeft;
} // else if( nColType > 0 )
else
{
LONG nInnerColCount =
(SiwScrollTypeVGet() == __ESIW_ST_VIRTUAL)
? LONG( OnGridQueryDataProvider().CacheColumnCountGet() )
: ColumnCountGet()
;
if( nColNo >= nInnerColCount )
return NULL; // invalid cell position
LONG nOuterColCountLeft = CExtGridBaseWnd::OuterColumnCountLeftGet();
LONG nOuterColCountRight = CExtGridBaseWnd::OuterColumnCountRightGet();
LONG nEffectiveShift = nOuterColCountLeft + nOuterColCountRight;
nEffectiveColNo += nEffectiveShift;
} // else from else if( nColType > 0 )
if( nRowType < 0 )
{
LONG nOuterRowCountTop = CExtGridBaseWnd::OuterRowCountTopGet();
if( nRowNo >= nOuterRowCountTop )
{
// invalid cell position
__EXT_DEBUG_GRID_ASSERT( FALSE );
return NULL;
}
} // if( nRowType < 0 )
else if( nRowType > 0 )
{
LONG nOuterRowCountBottom = CExtGridBaseWnd::OuterRowCountBottomGet();
if( nRowNo >= nOuterRowCountBottom )
{
// invalid cell position
__EXT_DEBUG_GRID_ASSERT( FALSE );
return NULL;
}
LONG nOuterRowCountTop = CExtGridBaseWnd::OuterRowCountTopGet();
nEffectiveRowNo += nOuterRowCountTop;
} // else if( nRowType > 0 )
else
{
LONG nInnerRowCount =
(SiwScrollTypeVGet() == __ESIW_ST_VIRTUAL)
? LONG( OnGridQueryDataProvider().CacheRowCountGet() )
: RowCountGet()
;
if( nRowNo >= nInnerRowCount )
return NULL; // invalid cell position
LONG nOuterRowCountTop = CExtGridBaseWnd::OuterRowCountTopGet();
LONG nOuterRowCountBottom = CExtGridBaseWnd::OuterRowCountBottomGet();
LONG nEffectiveShift = nOuterRowCountTop + nOuterRowCountBottom;
nEffectiveRowNo += nEffectiveShift;
} // else from else if( nRowType > 0 )
CExtGridDataProvider & _DataProvider = OnGridQueryDataProvider();
bool bRetVal = _DataProvider.CellRangeSet( ULONG(nEffectiveColNo), ULONG(nEffectiveRowNo), ULONG(nColCount), ULONG(nRowCount), pCell, true );
__EXT_DEBUG_GRID_ASSERT( bRetVal );
if( bRedraw )
{
OnSwUpdateScrollBars();
OnSwDoRedraw();
} // if( bRedraw )
return bRetVal;
}
|
|