604
社区成员
发帖
与我相关
我的任务
分享void __fastcall TForm1::Action1Execute(TObject *Sender)
{
TAction *CurrentAction;
TButton *CurrentButton;
if(!Sender->InheritsFrom(__classid(TAction)))return;
CurrentAction = dynamic_cast<TAction *>(Sender);
if (!CurrentAction->ActionComponent) return;
if(!CurrentAction->ActionComponent->InheritsFrom(__classid(TButton)))return;
CurrentButton = dynamic_cast<TButton *>(CurrentAction->ActionComponent);
ShowMessage(CurrentButton->Name);
}
TButton *ClickBtn;
ClickBtn= dynamic_cast<TButton *>(Sender);
ShowMessage(ClickBtn->Caption);