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' で指定する
このページのURL: