Question

in a MFC Project of mine, I was trying to override the virtual method BOOL OnUpdateMethod() from the CMFCPropertyGridProperty Class. The method's new implementation should update some child properties whenever a combobox on a parent property is changed.

So, I've created a new class using the CMFCPropertyGridProperty as a base class. Here's my problem: I am not being able to move forward because the compiler states to me that there is no appropriate constructor available (Error C2512). So, I've tried to declare and implement the same constructor of CMFCPropertyGridProperty and more errors are generated!

What should I do in order to implement any public virtual method properly? I believe that the solution for this is really simple, but I am kind of a noob at C++ and MFC.

Was it helpful?

Solution

According to the documentation, the constructor requires between 1 and 3 parameters. You need to supply those parameters via the initialization list of your own constructor.

class CMyGridProperty: public CMFCPropertyGridProperty
{
public:
    CMyGridProperty(const CString& strGroupName,
                    DWORD_PTR dwData=0,
                    BOOL bIsValueList=FALSE)
       : CMFCPropertyGridProperty(strGroupName, dwData, bIsValueList)
    {
    }
};
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top