CUtlProps::OnPropertyChanged
Called after setting a property to handle chained properties.
virtual HRESULT OnPropertyChanged(
ULONG /* iCurSet */,
DBPROP* pDBProp
);
Parameters
iCurSet
The index into the property-set array; zero if there is only one property set.pDBProp
The property ID and new value in a DBPROP structure.
Return Value
A standard HRESULT. The default return value is S_OK.
Remarks
If you want to handle chained properties, such as bookmarks or updates whose values are dependent on another property's value, you should override this function.
Example
In this function, the user gets the property ID from the DBPROP* parameter. Now, it is possible to compare the ID against a property to chain. When the property is found, SetProperties is called with the property that will now be set in conjunction with the other property. In this case, if one gets the DBPROP_IRowsetLocate, DBPROP_LITERALBOOKMARKS, or DBPROP_ORDEREDBOOKMARKS property, one can set the DBPROP_BOOKMARKS property.
HRESULT OnPropertyChanged(ULONG /*iCurSet*/, DBPROP* pDBProp)
{
ATLASSERT(pDBProp != NULL);
DWORD dwPropertyID = pDBProp->dwPropertyID;
if (dwPropertyID == DBPROP_IRowsetLocate ||
dwPropertyID == DBPROP_LITERALBOOKMARKS ||
dwPropertyID == DBPROP_ORDEREDBOOKMARKS)
{
CComVariant var = pDBProp->vValue;
if (var.boolVal == VARIANT_TRUE)
{
// Set the bookmarks property as these are chained
CComVariant bookVar(true);
CDBPropSet set(DBPROPSET_ROWSET);
set.AddProperty(DBPROP_BOOKMARKS, bookVar);
return SetProperties(1, &set);
}
}
return S_OK;
}
Requirements
Header: atldb.h