function
ShowRussianMessageDialog(
const
DlgCaption:
string
;
const
Msg:
string
; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons;
const
Title:
String
=
''
):
Integer
;
var
S:
string
;
Dialog: TTaskDialog;
begin
if
Trim(DlgCaption) =
''
then
case
DlgType
of
mtWarning: S :=
'Предупреждение'
;
mtError: S :=
'Ошибка'
;
mtInformation: S :=
'Информация'
;
mtConfirmation: S :=
'Подтверждение'
;
mtCustom: S :=
''
;
end
else
S := DlgCaption;
Dialog := TTaskDialog
.
Create(FindControl(Application
.
ActiveFormHandle));
try
Dialog
.
Caption := S;
Dialog
.
Text := Msg;
Dialog
.
Title := Title;
Dialog
.
Flags := Dialog
.
Flags + [tfPositionRelativeToWindow];
{$IFDEF VER340}
Dialog
.
Flags := Dialog
.
Flags + [tfSizeToContent];
{
$ENDIF
}
case
DlgType
of
TMsgDlgType
.
mtWarning: Dialog
.
MainIcon := tdiWarning;
TMsgDlgType
.
mtError: Dialog
.
MainIcon := tdiError;
TMsgDlgType
.
mtInformation: Dialog
.
MainIcon := tdiInformation;
TMsgDlgType
.
mtConfirmation: Dialog
.
MainIcon := tdiShield;
end
;
Dialog
.
CommonButtons := [];
if
mbOk
in
Buttons
then
Dialog
.
CommonButtons := Dialog
.
CommonButtons + [tcbOk];
if
mbYes
in
Buttons
then
Dialog
.
CommonButtons := Dialog
.
CommonButtons + [tcbYes];
if
mbNo
in
Buttons
then
Dialog
.
CommonButtons := Dialog
.
CommonButtons + [tcbNo];
if
mbCancel
in
Buttons
then
Dialog
.
CommonButtons := Dialog
.
CommonButtons + [tcbCancel];
if
mbRetry
in
Buttons
then
Dialog
.
CommonButtons := Dialog
.
CommonButtons + [tcbRetry];
if
mbClose
in
Buttons
then
Dialog
.
CommonButtons := Dialog
.
CommonButtons + [tcbClose];
Dialog
.
Execute;
Result := Dialog
.
ModalResult;
finally
Dialog
.
Free;
end
;
end
;