]> git.saurik.com Git - wxWidgets.git/commitdiff
fix lack of spin control update event when control lost focus (replaces patch 1630906...
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 11 Jan 2007 01:45:31 +0000 (01:45 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 11 Jan 2007 01:45:31 +0000 (01:45 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44194 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
src/msw/spinctrl.cpp

index 6352793634f3077d45c81ee6514904077f7fcacc..2e43c330b5cf1008e146de3a39d019cb7669321c 100644 (file)
@@ -88,6 +88,13 @@ Major new features in 2.8 release
   wxSearchCtrl, wxAboutBox, wxTreebook, tar streams.
 
 
   wxSearchCtrl, wxAboutBox, wxTreebook, tar streams.
 
 
+2.8.2
+-----
+
+wxMSW
+
+- Fix lack of spin control update event when control lost focus
+
 2.8.1
 -----
 
 2.8.1
 -----
 
index 80d15e665b62ac9770a796385deadfde525da2ab..d8368999a902772d9b434a544534b511a91abaee 100644 (file)
@@ -111,7 +111,6 @@ wxCONSTRUCTOR_6( wxSpinCtrl , wxWindow* , Parent , wxWindowID , Id , wxString ,
 IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl)
 #endif
 
 IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl)
 #endif
 
-//pmg EVT_KILL_FOCUS
 BEGIN_EVENT_TABLE(wxSpinCtrl, wxSpinButton)
     EVT_CHAR(wxSpinCtrl::OnChar)
 
 BEGIN_EVENT_TABLE(wxSpinCtrl, wxSpinButton)
     EVT_CHAR(wxSpinCtrl::OnChar)
 
@@ -269,16 +268,17 @@ void wxSpinCtrl::OnSetFocus(wxFocusEvent& event)
 
 void wxSpinCtrl::NormalizeValue()
 {
 
 void wxSpinCtrl::NormalizeValue()
 {
-    int value = GetValue();
-    SetValue( value );
-    if (value != m_oldValue)
-    {
-        wxCommandEvent event( wxEVT_COMMAND_SPINCTRL_UPDATED, GetId() );
-        event.SetEventObject( this );
-        event.SetInt( value );
-        GetEventHandler()->ProcessEvent( event );
-        m_oldValue = value;
-    }
+    const int value = GetValue();
+    if ( value == m_oldValue )
+        return;
+
+    SetValue(value);
+
+    wxCommandEvent event(wxEVT_COMMAND_SPINCTRL_UPDATED, GetId());
+    event.SetEventObject(this);
+    event.SetInt(value);
+    GetEventHandler()->ProcessEvent(event);
+    m_oldValue = value;
 }
 
 // ----------------------------------------------------------------------------
 }
 
 // ----------------------------------------------------------------------------
@@ -368,7 +368,7 @@ bool wxSpinCtrl::Create(wxWindow *parent,
 
     SetRange(min, max);
     SetValue(initial);
 
     SetRange(min, max);
     SetValue(initial);
-    
+
     m_oldValue = initial;
 
     // subclass the text ctrl to be able to intercept some events
     m_oldValue = initial;
 
     // subclass the text ctrl to be able to intercept some events
@@ -449,7 +449,7 @@ void  wxSpinCtrl::SetValue(int val)
         // current value in the control, so do it manually
         ::SetWindowText(GetBuddyHwnd(), wxString::Format(_T("%d"), val));
     }
         // current value in the control, so do it manually
         ::SetWindowText(GetBuddyHwnd(), wxString::Format(_T("%d"), val));
     }
-    
+
     m_oldValue = GetValue();
 }
 
     m_oldValue = GetValue();
 }
 
@@ -550,7 +550,7 @@ void wxSpinCtrl::OnSpinChange(wxSpinEvent& eventSpin)
     event.SetEventObject(this);
     int value = eventSpin.GetPosition();
     event.SetInt( value );
     event.SetEventObject(this);
     int value = eventSpin.GetPosition();
     event.SetInt( value );
-    
+
     if (value != m_oldValue)
         (void)GetEventHandler()->ProcessEvent(event);
 
     if (value != m_oldValue)
         (void)GetEventHandler()->ProcessEvent(event);
 
@@ -558,7 +558,7 @@ void wxSpinCtrl::OnSpinChange(wxSpinEvent& eventSpin)
     {
         event.Skip();
     }
     {
         event.Skip();
     }
-    
+
     m_oldValue = value;
 }
 
     m_oldValue = value;
 }