Fix ComboBox changing on scroll when in a scroll container (#192)

This commit is contained in:
rubenwardy 2023-04-14 19:58:13 +01:00 committed by GitHub
parent 7a3fc62ada
commit 896c825b9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -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;