From c52ed1aff3301c396f5a597adf66bc7944a76330 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 20 Oct 2017 02:38:14 +0200 Subject: [PATCH] Make "No" button default in the assert dialog This makes more sense than the default default (sic) "Yes" button, pressing which accidentally could kill the program if not running under the debugger. --- src/common/appbase.cpp | 2 +- src/common/appcmn.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/common/appbase.cpp b/src/common/appbase.cpp index 63512ccd38..b885f7d992 100644 --- a/src/common/appbase.cpp +++ b/src/common/appbase.cpp @@ -1307,7 +1307,7 @@ bool DoShowAssertDialog(const wxString& msg) wxT("further warnings."); switch ( ::MessageBox(NULL, msgDlg.t_str(), wxT("wxWidgets Debug Alert"), - MB_YESNOCANCEL | MB_ICONSTOP ) ) + MB_YESNOCANCEL | MB_DEFBUTTON2 | MB_ICONSTOP ) ) { case IDYES: // If we called wxTrap() directly from here, the programmer would diff --git a/src/common/appcmn.cpp b/src/common/appcmn.cpp index 16c79481e7..4c93db8584 100644 --- a/src/common/appcmn.cpp +++ b/src/common/appcmn.cpp @@ -485,8 +485,11 @@ bool wxGUIAppTraitsBase::ShowAssertDialog(const wxString& msg) wxT("You can also choose [Cancel] to suppress ") wxT("further warnings."); + // "No" button means to continue execution, so it should be the default + // action as leaving the "Yes" button the default one would mean that + // accidentally pressing Space or Enter would trap and kill the program. switch ( wxMessageBox(msgDlg, wxT("wxWidgets Debug Alert"), - wxYES_NO | wxCANCEL | wxICON_STOP ) ) + wxYES_NO | wxCANCEL | wxNO_DEFAULT | wxICON_STOP ) ) { case wxYES: // See the comment about using the same variable in