diff --git a/docs/changes.txt b/docs/changes.txt index d227b04427..98cafc4b42 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -653,6 +653,7 @@ wxMSW: - Fix clicking on togglable columns in wxDataViewCtrl (Laurent Poujoulat). - Fix expander in non left-most position in wxDataViewCtrl (Laurent Poujoulat). - Don't fail when using large paper sizes in print preview. +- Fix wxRichMessageDialog return value for dialog with only "OK" button. wxOSX: diff --git a/src/msw/richmsgdlg.cpp b/src/msw/richmsgdlg.cpp index 11ca12e0a2..5a97225887 100644 --- a/src/msw/richmsgdlg.cpp +++ b/src/msw/richmsgdlg.cpp @@ -73,6 +73,16 @@ int wxRichMessageDialog::ShowModal() } m_checkBoxValue = checkBoxChecked != FALSE; + // In case only an "OK" button was specified we actually created a + // "Cancel" button (see comment in MSWCommonTaskDialogInit). This + // results in msAns being IDCANCEL while we want IDOK (just like + // how the native MessageBox function does with only an "OK" button). + if ( (msAns == IDCANCEL) + && !(GetMessageDialogStyle() & (wxYES_NO|wxCANCEL)) ) + { + msAns = IDOK; + } + return MSWTranslateReturnCode( msAns ); } #endif // wxHAS_MSW_TASKDIALOG