SimpleGrid sample shows the way to "get notifications". You’ve been going to the right direction with subclassing, but it’s a little different with CExtGridWnd. You have to make a CExtGridCellBool-derived class and override the methods you need (in your case it’s DataSet). But take care the have these in your new cell class’s declaration (copied from SimpleGrids sample):
DECLARE_DYNCREATE( CDemoComboCell );
IMPLEMENT_ExtGridCell_Clone( CDemoComboCell, CExtGridCellStringDM );
CDemoComboCell(
CExtGridDataProvider * pDP = NULL
);
and also in .cpp, right after the includes:
// moved to top (i.e. before DEBUG_NEW) to avoid
// conflict with MFC’s operator new
IMPLEMENT_DYNCREATE( CDemoComboCell, CExtGridCellStringDM );
...
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
and the definition:
CDemoColoredCell::CDemoColoredCell(
CExtGridDataProvider * pDP // = NULL
)
: CExtGridCellStringDM( pDP )
{
}
The way you can use your class instead of CExtGridCellBool: you should use a code similar to this when initializing your grid:
CDemoComboCell * pCellString =
STATIC_DOWNCAST(
CDemoComboCell,
GridCellGet(
1L,
nRowNo,
0,
0,
RUNTIME_CLASS(CDemoComboCell)
)
);