]> git.saurik.com Git - wxWidgets.git/commitdiff
apply patch 1630906 after all as with my simpler fix in the last commit the control...
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 11 Jan 2007 01:48:52 +0000 (01:48 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 11 Jan 2007 01:48:52 +0000 (01:48 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44195 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/spinctrl.cpp

index d8368999a902772d9b434a544534b511a91abaee..a8882e40433acb8ae23469824d7a73393d0bf0c1 100644 (file)
@@ -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;
+    }
 }
 
 // ----------------------------------------------------------------------------