From 5ec60151bfce195b0eafc3ec8d98a44144aad8ba Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 10 Aug 2006 00:43:35 +0000 Subject: [PATCH] added NormalizeValue() which can be used to ensure that the control value is in range git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40540 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/spinbutt.h | 3 +++ src/msw/spinctrl.cpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/wx/msw/spinbutt.h b/include/wx/msw/spinbutt.h index 7113afac26..b8eeefe3dc 100644 --- a/include/wx/msw/spinbutt.h +++ b/include/wx/msw/spinbutt.h @@ -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) }; diff --git a/src/msw/spinctrl.cpp b/src/msw/spinctrl.cpp index 67083e3f1e..16c1f39b1e 100644 --- a/src/msw/spinctrl.cpp +++ b/src/msw/spinctrl.cpp @@ -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(); } -- 2.45.2