C++ builder xe关于FMX的消息弹出提示处理源码

演示效果:

C++ builder xe关于FMX的消息弹出提示处理源码

源码提示:

void __fastcall TForm2::btnMultipleButtonAlertClick(TObject *Sender)
{
  struct TCloseDialogHandler : public TCppInterfacedObject<TInputCloseDialogProc> {
    void __fastcall Invoke(const System::Uitypes::TModalResult AResult) {
      switch (AResult) {
      case mrYes :
        ShowMessage("You chose Yes");
        break;
      case mrNo:
        ShowMessage("You chose No");
        break;
      case mrCancel:
        ShowMessage("You chose Cancel");
        break;
      }
    }
  };
  _di_TInputCloseDialogProc handler = new TCloseDialogHandler();

  /* Show a multiple-button alert that triggers different code blocks according to
    your input */
  MessageDlg("Choose a button:", TMsgDlgType::mtInformation,
    TMsgDlgButtons() << TMsgD*n::mbYes << TMsgD*n::mbNo << TMsgD*n::mbCancel , 0, handler);
}