]> git.saurik.com Git - wxWidgets.git/commitdiff
added NormalizeValue() which can be used to ensure that the control value is in range
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 10 Aug 2006 00:43:35 +0000 (00:43 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 10 Aug 2006 00:43:35 +0000 (00:43 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40540 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/spinbutt.h
src/msw/spinctrl.cpp

index 7113afac2676245ebe4ac1df445016bed12b5535..b8eeefe3dc51d17ee6d9db35518a12d3f819a139 100644 (file)
@@ -60,6 +60,9 @@ public:
 protected:
    virtual wxSize DoGetBestSize() const;
 
+   // ensure that the control displays a value in the current range
+   void NormalizeValue() { SetValue(GetValue()); }
+
 private:
     DECLARE_DYNAMIC_CLASS_NO_COPY(wxSpinButton)
 };
index 67083e3f1e7a5c74f9e6c229e659663df9c4f1ae..16c1f39b1e1a017529f944eba7e14b4ab42ff41b 100644 (file)
@@ -253,8 +253,8 @@ void wxSpinCtrl::OnChar(wxKeyEvent& event)
 
 void wxSpinCtrl::OnKillFocus(wxFocusEvent& event)
 {
-    // ensure that the value is shown correctly
-    SetValue(GetValue()) ;
+    // ensure that a correct value is shown by the control
+    NormalizeValue();
     event.Skip();
 }