Setting Up Property Event Notifications

COM wrappers of AutoCAD objects must call the IAcadBaseObject2::Fire_Modified() and Fire_OnChanged() methods in each static property's put_ method. If you derive from IAcadBaseObject2Impl instead of directly implementing IAcadBaseObject2, call the Fire_Notification() method to handle both the Fire_Modified() and the Fire_OnChanged() notifications.

For dynamic properties on non-AutoCAD ActiveX objects, IDynamicProperty2 provides Connect() and Disconnect() methods. You should implement Connect() to store a pointer to the IDynamicPropertyNotify2 object. Implement Disconnect() to relinquish the connection by setting your internal copy to null.

The IDynamicPropertyNotify2 interface is used to notify the dynamic property that its value has been edited in the Property Inspector. This interface provides two methods: OnChanged() and GetCurrentSelectionSet(). OnChanged() notification is sent when the property is changing. Your IDynamicPropertyNotify2 object can call GetCurrentSelectionSet()

Listener objects typically connect to Property Inspector events using the Microsoft APIs demonstrated in the following code.

// Connect for events fired by the Property Inspector
ASSERT(mpInspector != NULL);
CComQIPtr<IConnectionPointContainer> pContainer = mpInspector;
CComPtr<IConnectionPoint> pConnection;
if (pContainer) {
    pContainer->FindConnectionPoint(
        IID_IAcPiPropertyInspectorInputEventSink, &pConnection);
    pConnection->Advise(mpInspectorSink, &mdwCookie);
    //mpInspectorSink is an IUnknown*
}

Later, the listener uses the mdwCookie value to delete the connection by calling Unadvise() on the pConnection pointer.