Allow Mouse Wheel For Input Key Selector

Hey! How can i set or allow the mouse wheeling for Input Key Selector. I tried to looking for answer for this question but i don’t found, just more older questions without answer.

Can be found under Project settings - Engine - Input

I can’t find this possibility to allow mouse wheeling for Input Key Selector.

Elias must have misread your question. There’s no such a setting under Engine->Input.

Input Key Selector completely ignores mouse wheel actions as of 4.22.1, which seems to be either a bug or an oversight.

Mouse wheel key binding is working in 4.22.1. If it’s not working in your project, then you have to hunt down every single one of its event calls. As far as I know, it can only be used once. The first blueprint that calls a mouse wheel event will consume it, and it will not work anywhere else. Choose the placement of your ONE mouse wheel call wisely. I suggest placing it in either your character’s blueprint or its controller. Then, from there, you can add an event dispatch that’s triggered by the mouse wheel event. Next, go to any other blueprint needing a mouse wheel event. From there, cast back to your char’s bp (preferably on event-begin-play), and bind its event dispatch to this other bp’s triggering event which requires the mouse wheel input.

This is my older topic with the same question, and still looking for any decision.

If you’re willing to modify the engine, you can avoid awkward Blueprint workarounds by modifying two files and solving it the “right” way. It was relatively straightforward to figure out how to do this since similar functions already existed, so my guess is this is indeed an oversight by Epic and I’m not sure how it hasn’t been patched yet (surely they ran into it themselves in their own games?)

The solution:

Put this:

SLATE_API virtual FReply OnMouseWheel(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override;

…into SInputKeySelector.h inside the SInputKeySelector class, preferably next to the other ‘OnKeyDown’ esque functions. Then, in SInputKeySelector.cpp:

FReply SInputKeySelector::OnMouseWheel(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
FKey MouseWheelKey = MouseEvent.GetWheelDelta() > 0 ? FKey(EKeys::MouseScrollUp) : FKey(EKeys::MouseScrollDown);
EModifierKey::Type ModifierKey = EModifierKey::FromBools(
MouseEvent.IsControlDown() && MouseWheelKey != EKeys::LeftControl && MouseWheelKey != EKeys::RightControl,
MouseEvent.IsAltDown() && MouseWheelKey != EKeys::LeftAlt && MouseWheelKey != EKeys::RightAlt,
MouseEvent.IsShiftDown() && MouseWheelKey != EKeys::LeftShift && MouseWheelKey != EKeys::RightShift,
MouseEvent.IsCommandDown() && MouseWheelKey != EKeys::LeftCommand && MouseWheelKey != EKeys::RightCommand );

// Don’t allow chords consisting of just modifier keys.
if ( bIsSelectingKey && (bAllowGamepadKeys || MouseWheelKey.IsGamepadKey() == false) && ( MouseWheelKey.IsModifierKey() == false || ModifierKey == EModifierKey::None ) )
{
SetIsSelectingKey( false );

  if (bEscapeCancelsSelection && (MouseWheelKey == EKeys::Escape || IsEscapeKey(MouseWheelKey)))
  {
  	return FReply::Handled();
  }

  SelectKey(
  	MouseWheelKey,
  	ModifierKey == EModifierKey::Shift,
  	ModifierKey == EModifierKey::Control,
  	ModifierKey == EModifierKey::Alt,
  	ModifierKey == EModifierKey::Command);
  return FReply::Handled();

}
else if (!bIsSelectingKey && Button.IsValid())
{
return Button->OnMouseWheel(MyGeometry, MouseEvent);
}

return SCompoundWidget::OnMouseWheel(MyGeometry, MouseEvent);
}

I just tested it now and it seems to work fine, I may have overlooked some details but it gets the job done