A control must notify the container when changes are made to a bound property by calling the BoundPropertyChanged
function.
Because Note is a Get/Set property, all changes to the property are confined to the SetNote
function, which is where BoundPropertyChanged
is called.
To modify the SetNote function to notify the container about changes to the Note property
SetNote
function in CIRCCTL.CPP: BoundPropertyChanged(dispidNote);
as shown in the following example:
void CCircCtrl::SetNote(LPCTSTR lpszNewValue)
{
if (m_note != lpszNewValue)
{
m_note = lpszNewValue;
SetModifiedFlag();
InvalidateControl();
BoundPropertyChanged(dispidNote);
}
}
The call to BoundPropertyChanged
is added after the m_note
member variable is updated, and all other actions involved in changing the Note property are completed.
The single parameter to BoundPropertyChanged
, dispidNote
, is the dispatch ID for the Note property. This parameter is defined in an enumeration in CIRCCTL.H:
// Dispatch and event IDs
public:
enum {
//{{AFX_DISP_ID(CCircCtrl)
...
dispidNote = 4L,
...
//}}AFX_DISP_ID
};