Good day,
I am using your property grid and used a custom button within my grid using the OnButtonPressed() this way:
IMPLEMENT_SERIAL(ExtraProperties, PropertyValue, VERSIONABLE_SCHEMA|1 );
ExtraProperties::ExtraProperties(MyProperty *pProp)
: PropertyValue(_T("More"), pProp)
{
CustomButt *pValue = STATIC_DOWNCAST(CustomButt, ValueActiveGetByRTC( RUNTIME_CLASS(CustomButt)));
pValue->TextSet("......");
pValue->ParentSet(this); //When this is initialized pValue->ParentProps is filled!
ValueDefaultFromActive();
}
void ExtraProperties::Apply(CExtGridCell * pValue)
{
PropertyValue::Apply( pValue );
}
MPLEMENT_SERIAL(CustomButt, CExtGridCellButton, VERSIONABLE_SCHEMA|1 );
CustomButt::CustomButt(CExtGridDataProvider * pDataProvider // = NULL
)
: CExtGridCellButton( pDataProvider )
{
ModifyStyle( __EGCS_BUTTON_ELLIPSIS | __EGCS_NO_INPLACE_CONTROL, 0 );
}
void CustomButt::OnButtonPressed(CExtGridWnd & wndGrid, INT nButtonType,
const RECT & rcCellExtra, const RECT & rcCell, LONG nVisibleColNo, LONG nVisibleRowNo,
LONG nColNo, LONG nRowNo, INT nColType, INT nRowType)
{
ASSERT_VALID( this );
ASSERT_VALID( (&wndGrid) );
CExtGridCellButton::OnButtonPressed(wndGrid, nButtonType,
rcCellExtra, rcCell, nVisibleColNo, nVisibleRowNo, nColNo, nRowNo,
nColType, nRowType);
this->ParentProps;//This should be the pointer to the PropertyValue but is NULL...
}
void CustomButt::ParentSet(ExtraProperties *par)
{
this->ParentProps = par;
}
I have highlited the problem. I was expecting to find the pointer to the "parent" so i could use something like :
Propstore.ItemGetByName("Button1") or
Propstore.ItemGetByName("Button2") etc. depending on which button i want to refer to was pressed.
Why is this happening? Is there any other way to overcome this? (Refere to the parent within the OnButtonPressed implementation)
Thanx in advance,
Stakon.