From: Julian Smart Date: Tue, 17 Jan 2006 16:47:55 +0000 (+0000) Subject: Applied patch [ 1374215 ] Bug fix to wxSpinCtrl for Windows X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/4a528443651296fc50db585e780173cbe5e42db3?ds=inline Applied patch [ 1374215 ] Bug fix to wxSpinCtrl for Windows Update valid value on kill focus By peter1079 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36930 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/spinctrl.cpp b/src/msw/spinctrl.cpp index 8beb9485ca..dbc1bdd3ff 100644 --- a/src/msw/spinctrl.cpp +++ b/src/msw/spinctrl.cpp @@ -109,11 +109,12 @@ wxCONSTRUCTOR_6( wxSpinCtrl , wxWindow* , Parent , wxWindowID , Id , wxString , IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl) #endif +//pmg EVT_KILL_FOCUS BEGIN_EVENT_TABLE(wxSpinCtrl, wxSpinButton) EVT_CHAR(wxSpinCtrl::OnChar) EVT_SET_FOCUS(wxSpinCtrl::OnSetFocus) - + EVT_KILL_FOCUS(wxSpinCtrl::OnKillFocus) EVT_SPIN(wxID_ANY, wxSpinCtrl::OnSpinChange) END_EVENT_TABLE() @@ -262,6 +263,13 @@ void wxSpinCtrl::OnChar(wxKeyEvent& event) event.Skip(); } +void wxSpinCtrl::OnKillFocus(wxFocusEvent& event) +{ + // ensure that the value is shown correctly + SetValue(GetValue()) ; + event.Skip(); +} + void wxSpinCtrl::OnSetFocus(wxFocusEvent& event) { // when we get focus, give it to our buddy window as it needs it more than