From: Vadim Zeitlin <vadim@wxwidgets.org> Date: Thu, 11 Jan 2007 01:48:52 +0000 (+0000) Subject: apply patch 1630906 after all as with my simpler fix in the last commit the control... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/b6d8301814c82933db8d6eec1bcdf8095dd81214 apply patch 1630906 after all as with my simpler fix in the last commit the control may remain empty when it is supposed to show 0 value git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44195 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/spinctrl.cpp b/src/msw/spinctrl.cpp index d8368999a9..a8882e4043 100644 --- a/src/msw/spinctrl.cpp +++ b/src/msw/spinctrl.cpp @@ -269,16 +269,21 @@ void wxSpinCtrl::OnSetFocus(wxFocusEvent& event) void wxSpinCtrl::NormalizeValue() { const int value = GetValue(); - if ( value == m_oldValue ) - return; + const bool changed = value == m_oldValue; + // notice that we have to call SetValue() even if the value didn't change + // because otherwise we could be left with empty buddy control when value + // is 0, see comment in SetValue() SetValue(value); - wxCommandEvent event(wxEVT_COMMAND_SPINCTRL_UPDATED, GetId()); - event.SetEventObject(this); - event.SetInt(value); - GetEventHandler()->ProcessEvent(event); - m_oldValue = value; + if ( changed ) + { + wxCommandEvent event(wxEVT_COMMAND_SPINCTRL_UPDATED, GetId()); + event.SetEventObject(this); + event.SetInt(value); + GetEventHandler()->ProcessEvent(event); + m_oldValue = value; + } } // ----------------------------------------------------------------------------