简体   繁体   中英

MFC - Overriding the virtual method OnUpdateValue() from the CMFCPropertyGridProperty class

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.

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)
    {
    }
};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM