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;
aMsgDlg.Color:=clYellow;
aMsgDlg.Caption:=’Pesan’;
for i := 0 to aMsgDlg.ComponentCount – 1 do
begin
if (aMsgDlg.Components[i] is TButton) then
begin
dlgButton := TButton(aMsgDlg.Components[i]);
if CaptionIndex > High(Captions) then Break;
dlgButton.Caption := Captions[CaptionIndex];
Inc(CaptionIndex);
end;
end;
Result := aMsgDlg.ShowModal;
end;
procedure Delay(msec: Longint);
var
start, stop: Longint;
begin
start := GetTickCount;
repeat
stop := GetTickCount;
Application.ProcessMessages;
until (stop – start) >= msec;
end;
procedure TForm1.btn1Click(Sender: TObject);
begin
if MyMessageDialog(‘Anda yakin…?’, mtConfirmation, mbOKCancel,
['Ya', 'Tidak']) = mrOk then
ShowMessage(‘”Ya” clicked‘)
else
ShowMessage(‘”Tidak” clicked‘);
end;
0 comments:
Post a Comment
Jangan Lupa Memberikan Komentar, Namun Tolong Agar Menggunakan Bahasa Yang BAIK dan SOPAN Terima Kasih...