function MyMessageDialog(const Msg: string; DlgType: TMsgDlgType;
Buttons: TMsgDlgButtons; Captions: arrayofstring): Integer;
var
aMsgDlg: TForm;
i: Integer;
dlgButton: TButton;
CaptionIndex: Integer;
begin{ Create the Dialog }{ Dialog erzeugen }
aMsgDlg := CreateMessageDialog(Msg, DlgType, Buttons);
captionIndex := 0;
{ Loop through Objects in Dialog }{ Uber alle Objekte auf dem Dialog iterieren}for i := 0 to aMsgDlg.ComponentCount - 1 dobegin{ If the object is of type TButton, then }{ Wenn es ein Button ist, dann...}if (aMsgDlg.Components[i] is TButton) thenbegin
dlgButton := TButton(aMsgDlg.Components[i]);
if CaptionIndex > High(Captions) then Break;
{ Give a new caption from our Captions array}{ Schreibe Beschriftung entsprechend Captions array}
dlgButton.Caption := Captions[CaptionIndex];
Inc(CaptionIndex);
end;
end;
Result := aMsgDlg.ShowModal;
end;
procedure TForm1.Button1Click(Sender: TObject);
beginif MyMessageDialog("How much...?", mtConfirmation, mbOKCancel,
["1", "2"]) = mrOk then
ShowMessage(""1" clicked")
else
ShowMessage(""2" clicked");
end;
Если Вас заинтересовала или понравилась информация по разработке на Delph - "Изменить заголовок кнопки в MessageDlg", Вы можете поставить закладку в социальной сети или в своём блоге на данную страницу: Так же Вы можете задать вопрос по работе этого модуля или примера через форму обратной связи, в сообщение обязательно указывайте название или ссылку на статью!