Alright, I think I figured it out. A little hackier than I’d preferer but it does the job.
There are a few parts to it.
-
Hiding mouse cursor and blocking mouse movement input (from hovering over buttons.)
In the Widget Stack Layout (See above video and/or Lyra Project,) add a full screen Canvas with Visibility: Visible and Cursor: None.
-
Transferring button focus to button selection, and blocking mouse click from robbing focus
In your button widgets base class
.h
UCLASS(Abstract, meta = (DisableNativeTick))
class TRIFECTA_API UTrifectaCommonButton : public UCommonButtonBase
{
GENERATED_BODY()
public:
#if PLATFORM_DESKTOP || WITH_EDITOR
virtual void NativeOnAddedToFocusPath(const FFocusEvent& InFocusEvent) override;
virtual void NativeOnRemovedFromFocusPath(const FFocusEvent& InFocusEvent) override;
virtual void NativeOnFocusChanging(const FWeakWidgetPath& PreviousFocusPath, const FWidgetPath& NewWidgetPath, const FFocusEvent& InFocusEvent) override;
#endif
};
.cpp
#if PLATFORM_DESKTOP || WITH_EDITOR
void UTrifectaCommonButton::NativeOnAddedToFocusPath(const FFocusEvent& InFocusEvent)
{
if (InFocusEvent.GetCause() != EFocusCause::Mouse)
{
SetSelectedInternal(true);
Super::NativeOnAddedToFocusPath(InFocusEvent);
}
}
void UTrifectaCommonButton::NativeOnRemovedFromFocusPath(const FFocusEvent& InFocusEvent)
{
if (InFocusEvent.GetCause() != EFocusCause::Mouse)
{
SetSelectedInternal(false);
Super::NativeOnRemovedFromFocusPath(InFocusEvent);
}
}
void UTrifectaCommonButton::NativeOnFocusChanging(const FWeakWidgetPath& PreviousFocusPath, const FWidgetPath& NewWidgetPath, const FFocusEvent& InFocusEvent)
{
if (InFocusEvent.GetCause() != EFocusCause::Mouse)
{
Super::NativeOnFocusChanging(PreviousFocusPath, NewWidgetPath, InFocusEvent);
}
else
{
SetKeyboardFocus();
}
}
#endif
- Adding Selected variations to your Button Style
Before
After
Selected Base
is the new Normal Hovered
Selected Pressed
is the new Normal Pressed