Top/Delphi/MessageDlgのデフォルトボタンを変更する

Delphi/MessageDlgのデフォルトボタンを変更する の変更点


以下の方法で実装できます。

 function MessageDlgEx(const Msg: string; DlgType: TMsgDlgType; Buttons:  TMsgDlgButtons;Default:String): Word;
 var dlg: TForm;
     res: Word;
 begin
   dlg := CreateMessageDialog(Msg, DlgType,Buttons);
   dlg.ActiveControl := TWinControl(dlg.FindComponent(Default));
   res := dlg.ShowModal;
   dlg.Free;
   MessageDlgEx := res;
 end;

デフォルトボタンは 'Yes', 'No', 'OK', 'Cancel', 'Abort', 'Retry', 'Ignore', 'All', 'Help' で指定する

-[[MessageDlg のデフォルトボタンを変更したい。>http://www.asahi-net.or.jp/~HA3T-NKMR/tips011.htm]]

ページ新規作成

新しいページはこちらから投稿できます。

TOP