title: Best way to reimplement CMFCPropertyGridProperty class (MFC)
body: <p>Some days ago, I was trying to implement a method that would detect when a value was updated in my Properties Window (<code>CPropertiesWnd</code>) and do some other stuff in a MFC application of mine. Since I was mostly using <code>CMFCPropertyGridProperty</code> instances in order to deal with the information contained in my Properties Window, I've decided to implement the method <code>BOOL CMFCPropertyGridProperty::OnUpdateValue()</code> (virtual), which is called automatically by the framework whenever something in my property grid has changed. So, since I am not able to modify the <code>CMFCPropertyGridProperty</code> class (and other files like <code>afxpropertygridctrl.h</code>), I've created an auxiliary class to do so:</p>
  
  <pre><code>#pragma once
  
  
  // CMFCPropertyGridPropertyAux
  
  class CMFCPropertyGridPropertyAux : public CMFCPropertyGridProperty
  {
  public:
  
      CMFCPropertyGridPropertyAux(const CString&amp; strGroupName, DWORD_PTR dwData=0, BOOL bIsValueList=FALSE);
      CMFCPropertyGridPropertyAux(const CString&amp; strName, const COleVariant&amp; varValue, LPCTSTR lpszDescr = NULL, DWORD_PTR dwData = 0,
          LPCTSTR lpszEditMask = NULL, LPCTSTR lpszEditTemplate = NULL, LPCTSTR lpszValidChars = NULL);
      virtual ~CMFCPropertyGridPropertyAux();
      BOOL OnUpdateValue();
  };
  
  
  // MFCPropertyGridPropertyAux.cpp : implementation file
  //
  
  #include "stdafx.h"
  #include "MFCProject.h"
  #include "MFCPropertyGridPropertyAux.h"
  
  
  // CMFCPropertyGridPropertyAux
  
  CMFCPropertyGridPropertyAux::CMFCPropertyGridPropertyAux(const CString&amp; strGroupName, DWORD_PTR dwData,BOOL bIsValueList):CMFCPropertyGridProperty(strGroupName, dwData, bIsValueList)
  {
  }
  
  CMFCPropertyGridPropertyAux::CMFCPropertyGridPropertyAux(const CString&amp; strName, const COleVariant&amp; varValue, LPCTSTR lpszDescr, DWORD_PTR dwData,
          LPCTSTR lpszEditMask, LPCTSTR lpszEditTemplate, LPCTSTR lpszValidChars):CMFCPropertyGridProperty(strName, varValue, lpszDescr, dwData, lpszEditMask, lpszEditTemplate, lpszValidChars)
  {
  }
  
  
  CMFCPropertyGridPropertyAux::~CMFCPropertyGridPropertyAux()
  {
  }
  
  
  BOOL CMFCPropertyGridPropertyAux::OnUpdateValue() //virtual method implementation
  {
      AfxMessageBox(L"Value Changed");
          //do other stuff
      return true;
  }
  </code></pre>
  
  <p>I was able to detect whenever a property was in fact changed, but there were a few bugs (like erasing the whole updated information after the appearance of the MessageBox), which are possibly related to the other methods and attributes from the <code>CMFCPropertyGridProperty</code> that still weren't implemented in this auxiliary class.
  I was wondering: It will be a whopping job to implement everything that is contained in the <code>CMFCPropertyGridProperty</code> class in my auxiliary class (just like I've done with the constructors). Should there be an strategy regarding OOP that should do the trick? Also, I don't know if my approach is the best one. I mean, is there a simplier way in order to implement the <code>BOOL CMFCPropertyGridProperty::OnUpdateValue()</code> without rewriting codes from another class? Any ideas are welcome!</p>