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:
Václav Slavík
2010-04-05 17:19:04 +00:00
parent 10265e6c41
commit c765e6fb9d
4 changed files with 81 additions and 31 deletions

View File

@@ -523,6 +523,7 @@ protected:
void OnTextCtrlEvent(wxCommandEvent& event);
void OnSysColourChanged(wxSysColourChangedEvent& event);
void OnKeyEvent(wxKeyEvent& event);
void OnCharEvent(wxKeyEvent& event);
// Set customization flags (directs how wxComboCtrlBase helpers behave)
void Customize( wxUint32 flags ) { m_iFlags |= flags; }
@@ -726,10 +727,14 @@ public:
// Default implementation draws value as string.
virtual void PaintComboControl( wxDC& dc, const wxRect& rect );
// Receives key events from the parent wxComboCtrl.
// Receives wxEVT_KEY_DOWN key events from the parent wxComboCtrl.
// Events not handled should be skipped, as usual.
virtual void OnComboKeyEvent( wxKeyEvent& event );
// Receives wxEVT_CHAR key events from the parent wxComboCtrl.
// Events not handled should be skipped, as usual.
virtual void OnComboCharEvent( wxKeyEvent& event );
// Implement if you need to support special action when user
// double-clicks on the parent wxComboCtrl.
virtual void OnComboDoubleClick();