本文整理汇总了C++中TObject::Dispatch方法的典型用法代码示例。如果您正苦于以下问题:C++ TObject::Dispatch方法的具体用法?C++ TObject::Dispatch怎么用?C++ TObject::Dispatch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TObject
的用法示例。
在下文中一共展示了TObject::Dispatch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetVersionInfo
void __fastcall TCustomVersionInfoLabel::SetVersionInfo(TVersionInfo* Value)
{
if (Value != FVersionInfo)
{
TCMVersionInfoUi NotifcationMessage = { };
TObject* Downcast;
NotifcationMessage.UiElement = this;
if (FVersionInfo != NULL)
{
NotifcationMessage.Msg = CM_VERSIONINFOUIDETACH;
Downcast = FVersionInfo;
Downcast->Dispatch(&NotifcationMessage);
}
FVersionInfo = Value;
if (FVersionInfo != NULL)
{
NotifcationMessage.Msg = CM_VERSIONINFOUIATTACH;
Downcast = FVersionInfo;
Downcast->Dispatch(&NotifcationMessage);
}
UpdateLabelContent();
}
}
示例2: DoChanged
void __fastcall TVersionInfo::DoChanged(void)
{
TCMVersionInfoComponent NotificationMessage = { };
NotificationMessage.Msg = CM_VERSIONINFOCHANGE;
NotificationMessage.Component = this;
//Changed Roy:
for (int i = 0; i < FUiElements->Count; ++i)
{
TObject* AnUiElement;
// Trick: Since in our UI elements the message map as implemented
// through the overridden Dispatch method is not public,
// we down-cast to a descendant (TObject) where Dispatch is
// public and then call Dispatch.
// This technique works because Dispatch is virtual.
AnUiElement = static_cast<TObject*>(FUiElements->Items[i]);
assert(AnUiElement != NULL);
AnUiElement->Dispatch(&NotificationMessage);
}
if (FOnChange != NULL)
{
FOnChange(this);
}
}