X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3672f9d04dbb1d8ee758e5f326c36b43cf5f69f8..cd4e467319637fdbbdb7774485e8dc78fb8272a2:/src/msw/msgdlg.cpp diff --git a/src/msw/msgdlg.cpp b/src/msw/msgdlg.cpp index c66806fee4..2334638d82 100644 --- a/src/msw/msgdlg.cpp +++ b/src/msw/msgdlg.cpp @@ -721,16 +721,29 @@ void wxMSWTaskDialogConfig::MSWCommonTaskDialogInit(TASKDIALOGCONFIG &tdc) } else // without Yes/No we're going to have an OK button { - AddTaskDialogButton(tdc, IDOK, TDCBF_OK_BUTTON, btnOKLabel); - if ( style & wxCANCEL ) { + AddTaskDialogButton(tdc, IDOK, TDCBF_OK_BUTTON, btnOKLabel); AddTaskDialogButton(tdc, IDCANCEL, TDCBF_CANCEL_BUTTON, btnCancelLabel); if ( style & wxCANCEL_DEFAULT ) tdc.nDefaultButton = IDCANCEL; } + else // Only "OK" + { + // We actually create a "Cancel" button instead because we want to + // allow closing the dialog box with Escape (and also Alt-F4 or + // clicking the close button in the title bar) which wouldn't work + // without a Cancel button. + if ( !useCustomLabels ) + { + useCustomLabels = true; + btnOKLabel = _("OK"); + } + + AddTaskDialogButton(tdc, IDCANCEL, TDCBF_CANCEL_BUTTON, btnOKLabel); + } } }