Bindable Properties: Change Notifications
If an ActiveX control has a property designated as bindable, the control will send an OnChanged notification to its container when the value of the property changes inside the control. In addition, the control can send an OnRequestEdit notification for a property whose value is about to change but has not yet changed. If the container returns FALSE from its OnRequestEdit handler, the control should not change the property value.MFC fully supports property change notifications in ActiveX control containers, but as of Visual C++ .NET, no wizard support is available. That means you must manually add entries to your container class's event sink map.Suppose you have an ActiveX control with a bindable property named Note with a dispatch ID of 4. You add an ON_PROPNOTIFY macro to the EVENTSINK macros in this way:
BEGIN_EVENTSINK_MAP(CAboutDlg, CDialog)
ON_PROPNOTIFY(CAboutDlg, IDC_MYCTRL1, 4, OnNoteRequestEdit,
OnNoteChanged)
END_EVENTSINK_MAP()
You must then code the OnNoteRequestEdit and OnNoteChanged functions with return types and parameter types exactly as shown here:
BOOL CMyDlg::OnNoteRequestEdit(BOOL* pb)
{
TRACE("CMyDlg::OnNoteRequestEdit\n");
*pb = TRUE; // TRUE means change request granted
return TRUE;
}
BOOL CMyDlg::OnNoteChanged()
{
TRACE("CMyDlg::OnNoteChanged\n");
return TRUE;
}
You'll also need corresponding prototypes in the class header, as shown here:
afx_msg BOOL OnNoteRequestEdit(BOOL* pb);
afx_msg BOOL OnNoteChanged();