There are several occasions when Container needs to send the HINT_UPDATE_ITEM
hint for a CContainerItem
object, for example, when the object is selected, deselected, resized, or otherwise changed. The HINT_UPDATE_ITEM
hint must be passed to OnUpdate
in conjunction with the CObject* pHint parameter, which is a pointer to CContainerItem
. Thus, it makes sense to have the CContainerItem
object itself send the update hint by using the document’s UpdateAllViews
function. CContainerItem::InvalidateItem
is a helper function that you can call whenever you want to send the hint.
To centralize the sending of update hints in the CContainerItem object
CContainerItem
.void
.InvalidateItem()
CContainerItem::InvalidateItem
, type the following code inside the handler: GetDocument()->UpdateAllViews(NULL, HINT_UPDATE_ITEM, this);
Note that the framework keeps track of which document object owns the CContainerItem
object and therefore implements CContainerItem::GetDocument
.