Professional UI Solutions
Site Map   /  Register
 
 

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.

Forums » Prof-UIS General Discussion » Derive from CExtGridCellButton Collapse All
Subject Author Date
Bart Kampers Jul 27, 2009 - 8:25 AM

Hello,

I derived my class from CExtGridCellButton like this:

// header file
class CFlushCell : public CExtGridCellButton
{
public:
DECLARE_SERIAL(CFlushCell)
IMPLEMENT_ExtGridCell_Clone(CFlushCell, CExtGridCellButton);
CFlushCell(CExtGridDataProvider* pDataProvider = NULL) : CExtGridCellButton(pDataProvider) {}

virtual void OnButtonPressed(CExtGridWnd & wndGrid, INT nButtonType, const RECT & rcCellExtra, const RECT & rcCell, LONG nVisibleColNo,
LONG nVisibleRowNo, LONG nColNo, LONG nRowNo, INT nColType, INT nRowType) {}
};


// cpp file
IMPLEMENT_SERIAL(CFlushCell, CExtGridCellButton, VERSIONABLE_SCHEMA | 1)


When I compile this I get:

Error    254    error C2665: ’CExtGridCell::operator new’ : none of the 2 overloads could convert all the argument types    d:\development\efg400_trunk\EFG400\Software\NewGui\ExitControlStateGrid.cpp    38


I did this in some other projects in exactly the same way where it gave no problems at all. Why do I get an error now?

Thanks in advance,

Bart.


Technical Support Jul 27, 2009 - 12:04 PM

The IMPLEMENT_SERIAL statement should be placed at the very beginning of the CPP file before the declaration of MFC’s debug version of C++ new operator:

IMPLEMENT_SERIAL(CFlushCell, CExtGridCellButton, VERSIONABLE_SCHEMA | 1)

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
The CExtGridCell class defines its own versions of the C++ new and delete operators. The MFC’s debug versions of these operators are incompatible with in-class defined operators.