Allow using horizontal cursor navigation keys in non-readonly wxComboCtrl.

Don't intercept Left/Right/Home/End keys until the control is read-only,
otherwise they're more useful for navigating in its text part than in its
drop-down.

Closes #14648.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72485 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2012-09-14 22:26:31 +00:00
parent 9cc8cedaae
commit 39191cbfdb

View File

@ -277,12 +277,14 @@ bool wxVListBoxComboPopup::HandleKey( int keycode, bool saturate, wxChar keychar
keychar = 0;
}
if ( keycode == WXK_DOWN || keycode == WXK_NUMPAD_DOWN || keycode == WXK_RIGHT )
const bool readOnly = (comboStyle & wxCB_READONLY) != 0;
if ( keycode == WXK_DOWN || keycode == WXK_NUMPAD_DOWN || ( keycode == WXK_RIGHT && readOnly ) )
{
value++;
StopPartialCompletion();
}
else if ( keycode == WXK_UP || keycode == WXK_NUMPAD_UP || keycode == WXK_LEFT )
else if ( keycode == WXK_UP || keycode == WXK_NUMPAD_UP || ( keycode == WXK_LEFT && readOnly ) )
{
value--;
StopPartialCompletion();
@ -297,17 +299,17 @@ bool wxVListBoxComboPopup::HandleKey( int keycode, bool saturate, wxChar keychar
value-=10;
StopPartialCompletion();
}
else if ( keycode == WXK_HOME || keycode == WXK_NUMPAD_HOME )
else if ( ( keycode == WXK_HOME || keycode == WXK_NUMPAD_HOME ) && readOnly )
{
value=0;
StopPartialCompletion();
}
else if ( keycode == WXK_END || keycode == WXK_NUMPAD_END )
else if ( ( keycode == WXK_END || keycode == WXK_NUMPAD_END ) && readOnly )
{
value=itemCount-1;
StopPartialCompletion();
}
else if ( keychar && (comboStyle & wxCB_READONLY) )
else if ( keychar && readOnly )
{
// Try partial completion