The code above seems to be fine, but please also include the following codes:
In .h in your class declaration:
public:
DECLARE_DYNCREATE( MyGridCellComboBox);
IMPLEMENT_ExtGridCell_Clone( MyGridCellComboBox, CExtGridCellComboBox);
MyGridCellComboBox(
CExtGridDataProvider * pDP = NULL
);
At the very top of your .cpp:
// moved to top (i.e. before DEBUG_NEW) to avoid
// conflict with MFC’s operator new
IMPLEMENT_DYNCREATE( MyGridCellComboBox, CExtGridCellComboBox);
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
... // any other code
MyGridCellComboBox::MyGridCellComboBox(
CExtGridDataProvider * pDP // = NULL
)
: CExtGridCellComboBox( pDP )
{
}
To have the new cell used in your grid, use this code when initializing the grid:
MyGridCellComboBox* pCellString =
STATIC_DOWNCAST(
MyGridCellComboBox,
GridCellGet(nColNo, nRowNo, 0, 0, RUNTIME_CLASS(MyGridCellComboBox) )
);
... // other initializitions of the cell
You can see how its done in the SimpleGrids sample. Look for the class CDemoComboCell.