From e7521d7b2c19a1bf70b23e75fbdd866e9a71e954 Mon Sep 17 00:00:00 2001 From: Night-Wisp Date: Tue, 30 Aug 2022 19:51:04 -0600 Subject: [PATCH] Fix two minor UI problems in the Bombs demo Error 1: When enabling/disabling easy corner, the enable/disable text was mixed up. This resulted in being asked to confirm disabling easy corner, when it was being enabled, and vice versa. Error 2: When choosing not to switch easy corner, the checkmark in the menu showing it's state still swapped. Fix 1: Swap the text for enable/disable in the confirm easy mode toggle dialog box. Fix 2: Call GetMenuBar()->Check(bombsID_EASYCORNER, m_easyCorner); (Check always returns void, and GetMenuBar is only called from the MenuBar, after it's been set up) to set the checkmark's state, when needed. Closes #22764. --- demos/bombs/bombs.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/demos/bombs/bombs.cpp b/demos/bombs/bombs.cpp index 1ce2ce315b..0e6c004108 100644 --- a/demos/bombs/bombs.cpp +++ b/demos/bombs/bombs.cpp @@ -183,9 +183,9 @@ void BombsFrame::OnEasyCorner(wxCommandEvent& WXUNUSED(event)) { wxString msg; if(m_easyCorner) - msg = wxT("enable"); - else msg = wxT("disable"); + else + msg = wxT("enable"); msg = wxT("Do you really want to ") + msg + wxT(" having\ntop left corner always empty for easier start?"); @@ -196,7 +196,12 @@ void BombsFrame::OnEasyCorner(wxCommandEvent& WXUNUSED(event)) this ); - if(ok!=wxYES)return; + if(ok!=wxYES) + { + // Undo the automatic change to the menu bar, keeping it in sync with the actual option value. + GetMenuBar()->Check(bombsID_EASYCORNER, m_easyCorner); + return; + } m_easyCorner = !m_easyCorner;