MessageDlg nin Butonlarının caption larını değiştirmek

Yazdığınız makaleleri ve üyelerimizin işine yarayacağını düşündüğünüz kodlarınızı gönderebilirsiniz. Bu foruma soru sormayın!
Cevapla
oguzozturk74
Kıdemli Üye
Mesajlar: 574
Kayıt: 01 Şub 2004 12:29
Konum: Erdemli - MERSİN

MessageDlg nin Butonlarının caption larını değiştirmek

Mesaj gönderen oguzozturk74 »

function MyMessageDialog(const Msg: string; DlgType: TMsgDlgType;
Buttons: TMsgDlgButtons; Captions: array of string): Integer;
var
aMsgDlg: TForm;
i: Integer;
dlgButton: TButton;
CaptionIndex: Integer;
begin
aMsgDlg := CreateMessageDialog(Msg, DlgType, Buttons);
captionIndex := 0;
for i := 0 to aMsgDlg.ComponentCount - 1 do
begin
if (aMsgDlg.Components is TButton) then
begin
dlgButton := TButton(aMsgDlg.Components);
if CaptionIndex > High(Captions) then Break;
dlgButton.Caption := Captions[CaptionIndex];
Inc(CaptionIndex);
end;
end;
Result := aMsgDlg.ShowModal;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
if MyMessageDialog('How much...?', mtConfirmation, mbOKCancel, ['Tamam', 'İptal']) = mrOk then
ShowMessage('"'Tamam'" tıklandı')
else
ShowMessage('"'İptal'" tıklandı');
end;
Cevapla