]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/spinctrl.cpp
WinCE build fixes.
[wxWidgets.git] / src / msw / spinctrl.cpp
index a5eb22d430d558d8f3be91c604fbfb522986dd79..16c1f39b1e1a017529f944eba7e14b4ab42ff41b 100644 (file)
@@ -200,28 +200,14 @@ wxSpinCtrl *wxSpinCtrl::GetSpinForTextCtrl(WXHWND hwndBuddy)
 // process a WM_COMMAND generated by the buddy text control
 bool wxSpinCtrl::ProcessTextCommand(WXWORD cmd, WXWORD WXUNUSED(id))
 {
-    switch (cmd)
+    if ( cmd == EN_CHANGE )
     {
-    case EN_CHANGE:
-        {
-            wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, GetId());
-            event.SetEventObject(this);
-            wxString val = wxGetWindowText(m_hwndBuddy);
-            event.SetString(val);
-            event.SetInt(GetValue());
-            return GetEventHandler()->ProcessEvent(event);
-        }
-    case EN_SETFOCUS:
-    case EN_KILLFOCUS:
-        {
-            wxFocusEvent event(cmd == EN_KILLFOCUS ? wxEVT_KILL_FOCUS
-                    : wxEVT_SET_FOCUS,
-                    m_windowId);
-            event.SetEventObject( this );
-            return GetEventHandler()->ProcessEvent(event);
-        }
-     default:
-        break;
+        wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, GetId());
+        event.SetEventObject(this);
+        wxString val = wxGetWindowText(m_hwndBuddy);
+        event.SetString(val);
+        event.SetInt(GetValue());
+        return GetEventHandler()->ProcessEvent(event);
     }
 
     // not processed
@@ -267,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();
 }