wxOwnerDrawnComboBox: handle numpad navigation keys.

For consitency with the native control, up/down/pgup/pgdown keys should
be handled even when pressed on the numpad.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63861 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2010-04-05 17:18:50 +00:00
parent f408451314
commit 293987e80c
3 changed files with 12 additions and 4 deletions

View File

@@ -271,22 +271,22 @@ bool wxVListBoxComboPopup::HandleKey( int keycode, bool saturate, wxChar unicode
} }
} }
if ( keycode == WXK_DOWN || keycode == WXK_RIGHT ) if ( keycode == WXK_DOWN || keycode == WXK_NUMPAD_DOWN || keycode == WXK_RIGHT )
{ {
value++; value++;
StopPartialCompletion(); StopPartialCompletion();
} }
else if ( keycode == WXK_UP || keycode == WXK_LEFT ) else if ( keycode == WXK_UP || keycode == WXK_NUMPAD_UP || keycode == WXK_LEFT )
{ {
value--; value--;
StopPartialCompletion(); StopPartialCompletion();
} }
else if ( keycode == WXK_PAGEDOWN ) else if ( keycode == WXK_PAGEDOWN || keycode == WXK_NUMPAD_PAGEDOWN )
{ {
value+=10; value+=10;
StopPartialCompletion(); StopPartialCompletion();
} }
else if ( keycode == WXK_PAGEUP ) else if ( keycode == WXK_PAGEUP || keycode == WXK_NUMPAD_PAGEUP )
{ {
value-=10; value-=10;
StopPartialCompletion(); StopPartialCompletion();

View File

@@ -605,14 +605,17 @@ void wxVListBox::OnKeyDown(wxKeyEvent& event)
switch ( event.GetKeyCode() ) switch ( event.GetKeyCode() )
{ {
case WXK_HOME: case WXK_HOME:
case WXK_NUMPAD_HOME:
current = 0; current = 0;
break; break;
case WXK_END: case WXK_END:
case WXK_NUMPAD_END:
current = GetRowCount() - 1; current = GetRowCount() - 1;
break; break;
case WXK_DOWN: case WXK_DOWN:
case WXK_NUMPAD_DOWN:
if ( m_current == (int)GetRowCount() - 1 ) if ( m_current == (int)GetRowCount() - 1 )
return; return;
@@ -620,6 +623,7 @@ void wxVListBox::OnKeyDown(wxKeyEvent& event)
break; break;
case WXK_UP: case WXK_UP:
case WXK_NUMPAD_UP:
if ( m_current == wxNOT_FOUND ) if ( m_current == wxNOT_FOUND )
current = GetRowCount() - 1; current = GetRowCount() - 1;
else if ( m_current != 0 ) else if ( m_current != 0 )
@@ -629,11 +633,13 @@ void wxVListBox::OnKeyDown(wxKeyEvent& event)
break; break;
case WXK_PAGEDOWN: case WXK_PAGEDOWN:
case WXK_NUMPAD_PAGEDOWN:
PageDown(); PageDown();
current = GetVisibleBegin(); current = GetVisibleBegin();
break; break;
case WXK_PAGEUP: case WXK_PAGEUP:
case WXK_NUMPAD_PAGEUP:
if ( m_current == (int)GetVisibleBegin() ) if ( m_current == (int)GetVisibleBegin() )
{ {
PageUp(); PageUp();

View File

@@ -831,6 +831,8 @@ bool wxComboCtrl::IsKeyPopupToggle(const wxKeyEvent& event) const
case WXK_DOWN: case WXK_DOWN:
case WXK_UP: case WXK_UP:
case WXK_NUMPAD_DOWN:
case WXK_NUMPAD_UP:
// On XP or with writable combo in Classic, arrows don't open the // On XP or with writable combo in Classic, arrows don't open the
// popup but Alt-arrow does // popup but Alt-arrow does
if ( event.AltDown() || if ( event.AltDown() ||