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

@@ -89,6 +89,7 @@ public:
virtual wxSize GetAdjustedSize( int minWidth, int prefHeight, int maxHeight );
virtual void PaintComboControl( wxDC& dc, const wxRect& rect );
virtual void OnComboKeyEvent( wxKeyEvent& event );
virtual void OnComboCharEvent( wxKeyEvent& event );
virtual void OnComboDoubleClick();
virtual bool LazyCreate();
@@ -117,8 +118,8 @@ public:
protected:
// Called by OnComboDoubleClick and OnComboKeyEvent
bool HandleKey( int keycode, bool saturate, wxChar unicode = 0 );
// Called by OnComboDoubleClick and OnCombo{Key,Char}Event
bool HandleKey( int keycode, bool saturate, wxChar keychar = 0 );
// sends combobox select event from the parent combo control
void SendComboBoxEvent( int selection );
@@ -164,6 +165,7 @@ protected:
void OnMouseMove(wxMouseEvent& event);
void OnMouseWheel(wxMouseEvent& event);
void OnKey(wxKeyEvent& event);
void OnChar(wxKeyEvent& event);
void OnLeftClick(wxMouseEvent& event);
// Return the widest item width (recalculating it if necessary)