]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't use wxTE_PROCESS_ENTER in wxSpinCtrlGeneric.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 26 Feb 2011 17:46:54 +0000 (17:46 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 26 Feb 2011 17:46:54 +0000 (17:46 +0000)
We don't need to catch Enter presses to generate spin control events as we do
it anyhow when we lose focus. So simply remove the Enter handling code
entirely (it could be used to generate wxEVT_COMMAND_TEXT_ENTER events but we
don't generate them nor wxEVT_COMMAND_TEXT_UPDATED at all currently in the
generic version).

Closes #12980.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67031 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/generic/spinctlg.h
src/generic/spinctlg.cpp

index 2cc581c92836028fc702f728736ef7fde9902248..aa44dc989af392454cfdb77c69a5ae5796f62857 100644 (file)
@@ -89,7 +89,7 @@ public:
 
     // forwarded events from children windows
     void OnSpinButton(wxSpinEvent& event);
-    void OnTextEnter(wxCommandEvent& event);
+    void OnTextLostFocus();
     void OnTextChar(wxKeyEvent& event);
 
     // this window itself is used only as a container for its sub windows so it
index 2628efefa62c8f49fe7ae6564b0301854d2c3d72..796f89efb584df931bf6755adff014c32ea464ef 100644 (file)
@@ -64,7 +64,7 @@ class wxSpinCtrlTextGeneric : public wxTextCtrl
 public:
     wxSpinCtrlTextGeneric(wxSpinCtrlGenericBase *spin, const wxString& value, long style=0)
         : wxTextCtrl(spin->GetParent(), wxID_ANY, value, wxDefaultPosition, wxDefaultSize,
-                     ( style & wxALIGN_MASK ) | wxTE_PROCESS_ENTER)
+                     style & wxALIGN_MASK)
     {
         m_spin = spin;
 
@@ -81,12 +81,6 @@ public:
         m_spin = NULL;
     }
 
-    void OnTextEnter(wxCommandEvent& event)
-    {
-        if (m_spin)
-            m_spin->OnTextEnter(event);
-    }
-
     void OnChar( wxKeyEvent &event )
     {
         if (m_spin)
@@ -96,10 +90,7 @@ public:
     void OnKillFocus(wxFocusEvent& event)
     {
         if (m_spin)
-        {
-            if ( m_spin->SyncSpinToText() )
-                m_spin->DoSendEvent();
-        }
+            m_spin->OnTextLostFocus();
 
         event.Skip();
     }
@@ -111,8 +102,6 @@ private:
 };
 
 BEGIN_EVENT_TABLE(wxSpinCtrlTextGeneric, wxTextCtrl)
-    EVT_TEXT_ENTER(wxID_ANY, wxSpinCtrlTextGeneric::OnTextEnter)
-
     EVT_CHAR(wxSpinCtrlTextGeneric::OnChar)
 
     EVT_KILL_FOCUS(wxSpinCtrlTextGeneric::OnKillFocus)
@@ -367,11 +356,10 @@ void wxSpinCtrlGenericBase::OnSpinButton(wxSpinEvent& event)
         DoSendEvent();
 }
 
-void wxSpinCtrlGenericBase::OnTextEnter(wxCommandEvent& event)
+void wxSpinCtrlGenericBase::OnTextLostFocus()
 {
     SyncSpinToText();
     DoSendEvent();
-    event.Skip();
 }
 
 void wxSpinCtrlGenericBase::OnTextChar(wxKeyEvent& event)