]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/spinctrl.cpp
Don't generate events from wxSpinCtrl::SetRange() in wxMSW.
[wxWidgets.git] / src / msw / spinctrl.cpp
index 921d767fb0f41d67f1e9b6c8eb5edbdc3b9d8832..94baaf380989f9d39da75dd52be471a40ebf17e0 100644 (file)
@@ -494,6 +494,14 @@ void wxSpinCtrl::SetSelection(long from, long to)
 
 void wxSpinCtrl::SetRange(int minVal, int maxVal)
 {
+    // Manually adjust the old value to avoid an event being sent from
+    // NormalizeValue() called from inside the base class SetRange() as we're
+    // not supposed to generate any events from here.
+    if ( m_oldValue < minVal )
+        m_oldValue = minVal;
+    else if ( m_oldValue > maxVal )
+        m_oldValue = maxVal;
+
     wxSpinButton::SetRange(minVal, maxVal);
 
     // this control is used for numeric entry so restrict the input to numeric