LCL: unduplicate message dialog standard captions localization code (patch by Bart Broersma, bug #19757)

git-svn-id: trunk@31748 -
This commit is contained in:
maxim 2011-07-19 20:13:18 +00:00
parent 211d9b8926
commit 51fed03303

View File

@ -501,28 +501,12 @@ begin
end;
function CreateMessageDialog(const Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons): TForm;
function MsgDlgCaptions(const DlgType: TMsgDlgType): String;
begin
case DlgType of
mtWarning: Result := rsMtWarning;
mtError: Result := rsMtError;
mtInformation: Result := rsMtInformation;
mtConfirmation: Result := rsMtConfirmation;
mtCustom: Result := rsMtCustom;
end;
end;
var
PDlg: TPromptDialog;
aCaption: String;
Btns: PLongInt;
CancelValue, DefaultIndex, ButtonCount: Longint;
begin
if DlgType <> mtCustom then
aCaption := MsgDlgCaptions(DlgType)
else
aCaption := Application.Title;
Btns := GetPromptUserButtons(Buttons, CancelValue, DefaultIndex, ButtonCount, False, mbOk);
PDlg := TPromptDialog.CreateMessageDialog(aCaption, Msg, DialogIds[DlgType], Btns, ButtonCount, DefaultIndex);
Result := TForm(PDlg);