diff --git a/src/gui/guiFormSpecMenu.cpp b/src/gui/guiFormSpecMenu.cpp index 97d86b05f..38193684f 100644 --- a/src/gui/guiFormSpecMenu.cpp +++ b/src/gui/guiFormSpecMenu.cpp @@ -4068,6 +4068,31 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event) { if (event.EventType==EET_KEY_INPUT_EVENT) { KeyPress kp(event.KeyInput); + // Ctrl (+ Shift) + Tab: Select the (previous or) next tab of a TabControl instance. + bool shift = event.KeyInput.Shift; + bool ctrl = event.KeyInput.Control; + if (event.KeyInput.PressedDown && (event.KeyInput.Key == KEY_TAB && ctrl)) { + // Try to find a tab control among our elements + for (const FieldSpec &s : m_fields) { + if (s.ftype != f_TabHeader) + continue; + + IGUIElement *element = getElementFromId(s.fid, true); + if (!element || element->getType() != gui::EGUIET_TAB_CONTROL) + continue; + + gui::IGUITabControl *tabs = static_cast(element); + s32 num_tabs = tabs->getTabCount(); + if (num_tabs <= 1) + continue; + + s32 active = tabs->getActiveTab(); + // Shift: Previous tab, No shift: Next tab + active = (active + (shift ? -1 : 1) + num_tabs) % num_tabs; + tabs->setActiveTab(active); + return true; // handled + } + } if (event.KeyInput.PressedDown && ( (kp == EscapeKey) || ((m_client != NULL) && (kp == getKeySetting("keymap_inventory"))))) { diff --git a/src/gui/guiTable.cpp b/src/gui/guiTable.cpp index c129c3c2b..3f2613510 100644 --- a/src/gui/guiTable.cpp +++ b/src/gui/guiTable.cpp @@ -831,8 +831,10 @@ bool GUITable::OnEvent(const SEvent &event) return true; } else if (event.KeyInput.Key == KEY_ESCAPE || - event.KeyInput.Key == KEY_SPACE) { + event.KeyInput.Key == KEY_SPACE || + (event.KeyInput.Key == KEY_TAB && event.KeyInput.Control)) { // pass to parent + return IGUIElement::OnEvent(event); } else if (event.KeyInput.PressedDown && event.KeyInput.Char) { // change selection based on text as it is typed