Fix return value of wxRichMessageDialog with only an "OK" button.
Apply the same workaround as was applied in r67771 to wxMessageDialog to wxRichMessageDialog and map IDCANCEL returned from it to IDOK if "Cancel" is the only button in the dialog -- as in this case it's really just a renamed (for convenience of allowing the user to use "Esc" to close it) "OK". Closes #16153. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76257 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -73,6 +73,16 @@ int wxRichMessageDialog::ShowModal()
|
|||||||
}
|
}
|
||||||
m_checkBoxValue = checkBoxChecked != FALSE;
|
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 );
|
return MSWTranslateReturnCode( msAns );
|
||||||
}
|
}
|
||||||
#endif // wxHAS_MSW_TASKDIALOG
|
#endif // wxHAS_MSW_TASKDIALOG
|
||||||
|
Reference in New Issue
Block a user