Merge wxComboCtrl::InstallInputHandlers() into CreateTextCtrl()
This function was always called after calling CreateTextCtrl() and couldn't be called at any other moment, so it didn't make much sense to have it as a separate function, just install the custom input handler when (re)creating the text control. This simplifies the derived classes code.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user