LCL: QuestionDlg: return mrCancel when dialog is closed by Esc or dialog close button. Issue #26019

git-svn-id: trunk@50369 -
This commit is contained in:
ondrej 2015-11-17 15:28:24 +00:00
parent aa945f4ab6
commit b264b1d936
3 changed files with 8 additions and 9 deletions

View File

@ -924,7 +924,6 @@ begin
end;
if DialogButtons.DefaultButton = nil then
DialogButtons.DefaultButton := DialogButtons.FindButton([mrYes, mrOk, mrYesToAll, mrAll, mrRetry, mrCancel, mrNo, mrNoToAll, mrAbort, mrIgnore]);
DialogButtons.CancelButton := DialogButtons.FindButton([mrCancel, mrAbort, mrNo, mrIgnore, mrNoToAll, mrYes, mrOk, mrRetry, mrAll, mrYesToAll]);
Result := WidgetSet.AskUser(aCaption, ConvertLineEndings(aMsg),
DialogIds[DlgType], DialogButtons, HelpCtx);
finally

View File

@ -975,7 +975,7 @@ var
begin
Result := mrNone;
ReleaseCapture;
ADialogResult := mrNone;
ADialogResult := mrCancel;
case DialogType of
idDialogWarning: GtkDialogType := GTK_MESSAGE_WARNING;
idDialogError: GtkDialogType := GTK_MESSAGE_ERROR;
@ -1000,11 +1000,6 @@ begin
CancelID := X;
ADialogResult := DlgBtn.ModalResult;
end;
if (ADialogResult = mrNone) and
(Buttons[X].ModalResult in [mrCancel, mrAbort, mrIgnore, mrNo, mrNoToAll])
then
ADialogResult := Buttons[X].ModalResult;
end;

View File

@ -391,8 +391,13 @@ begin
try
Result := IDCANCEL;
TaskDialogIndirect(@TaskConfig, @Result, nil, nil);
if (Result = IDCANCEL) and Assigned(Buttons.CancelButton) then
Result := Buttons.CancelButton.ModalResult;
if (Result = IDCANCEL) then
begin
if Assigned(Buttons.CancelButton) then
Result := Buttons.CancelButton.ModalResult
else
Result := mrCancel;
end;
finally
RestoreApplicationState(State);
for i := 0 to TaskConfig.cButtons - 1 do