Fix text input and completion in wxComboCtrl and wxOwnerDrawnComboBox.
Both wxEVT_KEY_DOWN and wxEVT_CHAR must be handled and only the latter used for completion (or any characters input). Don't make incorrect assumptions about wxEVT_CHAR keycodes either, it's only the Unicode character and printability that matter. Otherwise, completion in readonly controls wouldn't work correctly for e.g. numbers on numpad or non-ASCII characters. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63864 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -465,6 +465,7 @@ private:
|
||||
BEGIN_EVENT_TABLE(wxComboPopupWindowEvtHandler, wxEvtHandler)
|
||||
EVT_KEY_DOWN(wxComboPopupWindowEvtHandler::OnKeyEvent)
|
||||
EVT_KEY_UP(wxComboPopupWindowEvtHandler::OnKeyEvent)
|
||||
EVT_CHAR(wxComboPopupWindowEvtHandler::OnKeyEvent)
|
||||
#if USES_GENERICTLW
|
||||
EVT_ACTIVATE(wxComboPopupWindowEvtHandler::OnActivate)
|
||||
#endif
|
||||
@@ -552,6 +553,11 @@ void wxComboPopup::OnComboKeyEvent( wxKeyEvent& event )
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxComboPopup::OnComboCharEvent( wxKeyEvent& event )
|
||||
{
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxComboPopup::OnComboDoubleClick()
|
||||
{
|
||||
}
|
||||
@@ -780,6 +786,7 @@ BEGIN_EVENT_TABLE(wxComboCtrlBase, wxControl)
|
||||
EVT_IDLE(wxComboCtrlBase::OnIdleEvent)
|
||||
//EVT_BUTTON(wxID_ANY,wxComboCtrlBase::OnButtonClickEvent)
|
||||
EVT_KEY_DOWN(wxComboCtrlBase::OnKeyEvent)
|
||||
EVT_CHAR(wxComboCtrlBase::OnCharEvent)
|
||||
EVT_TEXT_ENTER(wxID_ANY,wxComboCtrlBase::OnTextCtrlEvent)
|
||||
EVT_SYS_COLOUR_CHANGED(wxComboCtrlBase::OnSysColourChanged)
|
||||
END_EVENT_TABLE()
|
||||
@@ -1830,6 +1837,27 @@ void wxComboCtrlBase::OnKeyEvent(wxKeyEvent& event)
|
||||
}
|
||||
}
|
||||
|
||||
void wxComboCtrlBase::OnCharEvent(wxKeyEvent& event)
|
||||
{
|
||||
if ( IsPopupShown() )
|
||||
{
|
||||
// pass it to the popped up control
|
||||
GetPopupControl()->GetControl()->GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
else // no popup
|
||||
{
|
||||
wxComboPopup* popupInterface = GetPopupControl();
|
||||
if ( popupInterface )
|
||||
{
|
||||
popupInterface->OnComboCharEvent(event);
|
||||
}
|
||||
else
|
||||
{
|
||||
event.Skip();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wxComboCtrlBase::OnFocusEvent( wxFocusEvent& event )
|
||||
{
|
||||
if ( event.GetEventType() == wxEVT_SET_FOCUS )
|
||||
|
Reference in New Issue
Block a user