From c03c654417b649f21f50f6bb55adebe0bb4f17c2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 13 Sep 2012 17:16:11 +0000 Subject: [PATCH] Relax wxMessageDialog style checks, assume wxOK by default. Don't complain if neither wxOK nor wxYES[_NO] are specified but just assume wxOK by default. This allows the code calling wxMessageBox() with just an icon flag to continue to work in the same way in 2.9 as it did in 2.8. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72479 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msgdlg.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/wx/msgdlg.h b/include/wx/msgdlg.h index 19818cf237..4dbd2d5ac2 100644 --- a/include/wx/msgdlg.h +++ b/include/wx/msgdlg.h @@ -125,8 +125,12 @@ public: wxASSERT_MSG( !(style & wxYES) || !(style & wxOK), "wxOK and wxYES/wxNO can't be used together" ); - wxASSERT_MSG( (style & wxYES) || (style & wxOK), - "one of wxOK and wxYES/wxNO must be used" ); + // It is common to specify just the icon, without wxOK, in the existing + // code, especially one written by Windows programmers as MB_OK is 0 + // and so they're used to omitting wxOK. Don't complain about it but + // just add wxOK implicitly for compatibility. + if ( !(style & wxYES) && !(style & wxOK) ) + style |= wxOK; wxASSERT_MSG( (style & wxID_OK) != wxID_OK, "wxMessageBox: Did you mean wxOK (and not wxID_OK)?" ); -- 2.45.2