New ComboBox : Fix for #11817 - Arrow keys advance Preset Listboxes but do not activate the Preset or update Preset Values

This commit is contained in:
YuSanka 2023-12-05 11:28:29 +01:00
parent 83a277b0c5
commit 0d13755c90

View File

@ -308,16 +308,12 @@ void ComboBox::keyDown(wxKeyEvent& event)
{
int key_code = event.GetKeyCode();
switch (key_code) {
case WXK_RETURN:
case WXK_RETURN: {
if (drop_down) {
drop.DismissAndNotify();
wxCommandEvent e(wxEVT_COMBOBOX);
e.SetEventObject(this);
e.SetId(GetId());
e.SetInt(GetSelection());
GetEventHandler()->ProcessEvent(e);
} else if (drop.HasDismissLongTime()) {
sendComboBoxEvent();
}
else if (drop.HasDismissLongTime()) {
drop.autoPosition();
drop_down = true;
drop.Popup();
@ -325,14 +321,19 @@ void ComboBox::keyDown(wxKeyEvent& event)
GetEventHandler()->ProcessEvent(e);
}
break;
}
case WXK_UP: {
if (GetSelection() > 0)
SetSelection(GetSelection() - 1);
if (!drop.IsShown())
sendComboBoxEvent();
break;
}
case WXK_DOWN: {
if (GetSelection() + 1 < int(texts.size()))
SetSelection(GetSelection() + 1);
if (!drop.IsShown())
sendComboBoxEvent();
break;
}
case WXK_LEFT: {