TMessageDlg how to use custom buttons?

Hi,

I have tried to use the CustomButtons property of the TMessageDlg class as follows:

procedure TMain.Form1Show(Sender: TObject);
var
  dlg:TMessageDlg;
  bttns:TCustomDialogButtons;
  button:TCustomDialogButton;
begin
  dlg:=TMessageDlg.Create(Self);
  bttns:=TCustomDialogButtons.Create(dlg, TCustomDialogButton);
  button:=bttns.Add;
  dlg.CustomButtons:=bttns;
  dlg.Show;
end;

The code does not work, saying 'Cannot assign a TCustomDialogButton to a TCustomDialogButton'.

Have I done something wrong here?

Thanks

All you need to do is something like:

WebMessageDialog.CustomButtons.Add.Caption = 'mybtn';

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.