diff --git a/include/wx/combo.h b/include/wx/combo.h index 8becce369c..91f2e5d392 100644 --- a/include/wx/combo.h +++ b/include/wx/combo.h @@ -509,9 +509,6 @@ protected: // (e.g. from WriteText()) void OnSetValue(const wxString& value); - // Installs standard input handler to combo (and optionally to the textctrl) - void InstallInputHandlers(); - // Flags for DrawButton enum { diff --git a/src/common/combocmn.cpp b/src/common/combocmn.cpp index b61aac35bf..323d85bd96 100644 --- a/src/common/combocmn.cpp +++ b/src/common/combocmn.cpp @@ -1068,22 +1068,19 @@ bool wxComboCtrlBase::Create(wxWindow *parent, return true; } -void wxComboCtrlBase::InstallInputHandlers() -{ - if ( m_text ) - { - m_textEvtHandler = new wxComboBoxExtraInputHandler(this); - m_text->PushEventHandler(m_textEvtHandler); - } -} - void wxComboCtrlBase::CreateTextCtrl(int style) { if ( !(m_windowStyle & wxCB_READONLY) ) { if ( m_text ) + { + m_text->RemoveEventHandler(m_textEvtHandler); + delete m_textEvtHandler; + m_textEvtHandler = NULL; + m_text->Destroy(); + } // wxTE_PROCESS_TAB is needed because on Windows, wxTAB_TRAVERSAL is // not used by the wxPropertyGrid and therefore the tab is processed by @@ -1094,14 +1091,6 @@ wxComboCtrlBase::CreateTextCtrl(int style) if ( HasFlag(wxTE_PROCESS_ENTER) ) style |= wxTE_PROCESS_ENTER; - // Ignore EVT_TEXT generated by the constructor (but only - // if the event redirector already exists) - // NB: This must be " = 1" instead of "++"; - if ( m_textEvtHandler ) - m_ignoreEvtText = 1; - else - m_ignoreEvtText = 0; - m_text = new wxComboCtrlTextCtrl(); m_text->Create(this, wxID_ANY, m_valueString, wxDefaultPosition, wxSize(10,-1), @@ -1115,6 +1104,9 @@ wxComboCtrlBase::CreateTextCtrl(int style) } m_text->SetHint(m_hintText); + + m_textEvtHandler = new wxComboBoxExtraInputHandler(this); + m_text->PushEventHandler(m_textEvtHandler); } } diff --git a/src/generic/combog.cpp b/src/generic/combog.cpp index bae13d912f..5b1bcc26ca 100644 --- a/src/generic/combog.cpp +++ b/src/generic/combog.cpp @@ -177,9 +177,6 @@ bool wxGenericComboCtrl::Create(wxWindow *parent, // Create textctrl, if necessary CreateTextCtrl( tcBorder ); - // Add keyboard input handlers for main control and textctrl - InstallInputHandlers(); - // Set background style for double-buffering, when needed // (cannot use when system draws background automatically) if ( !HasTransparentBackground() ) @@ -419,12 +416,7 @@ void wxGenericComboCtrl::SetCustomPaintWidth( int width ) // Common textctrl re-creation code if ( tcCreateStyle != -1 ) { - tc->RemoveEventHandler(m_textEvtHandler); - delete m_textEvtHandler; - CreateTextCtrl( tcCreateStyle ); - - InstallInputHandlers(); } } #endif // UNRELIABLE_TEXTCTRL_BORDER diff --git a/src/msw/combo.cpp b/src/msw/combo.cpp index adb8ccab0d..cac21a05fb 100644 --- a/src/msw/combo.cpp +++ b/src/msw/combo.cpp @@ -120,9 +120,6 @@ bool wxComboCtrl::Create(wxWindow *parent, // Create textctrl, if necessary CreateTextCtrl( wxNO_BORDER ); - // Add keyboard input handlers for main control and textctrl - InstallInputHandlers(); - // SetInitialSize should be called last SetInitialSize(size);