From 896c825b9e8690fcc9118458fd686a3ef1f006ac Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Fri, 14 Apr 2023 19:58:13 +0100 Subject: [PATCH] Fix ComboBox changing on scroll when in a scroll container (#192) --- source/Irrlicht/CGUIComboBox.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/Irrlicht/CGUIComboBox.cpp b/source/Irrlicht/CGUIComboBox.cpp index ecd3a9c2..0494aa3e 100644 --- a/source/Irrlicht/CGUIComboBox.cpp +++ b/source/Irrlicht/CGUIComboBox.cpp @@ -320,6 +320,10 @@ bool CGUIComboBox::OnEvent(const SEvent& event) } case EMIE_MOUSE_WHEEL: { + // Try scrolling parent first + if (IGUIElement::OnEvent(event)) + return true; + s32 oldSelected = Selected; setSelected( Selected + ((event.MouseInput.Wheel < 0) ? 1 : -1)); @@ -329,11 +333,12 @@ bool CGUIComboBox::OnEvent(const SEvent& event) if (Selected >= (s32)Items.size()) setSelected((s32)Items.size() -1); - if (Selected != oldSelected) - { + if (Selected != oldSelected) { sendSelectionChangedEvent(); return true; } + + return false; } default: break;