I have a slate widget derived from SCustomWidget.
I give focus to that widget with something like this.
FInputModeUIOnly Mode;
Mode.SetWidgetToFocus(MainPlayerUI);
GetOwningPlayerController()->SetInputMode(Mode);
I have a overridden the OnKeyDown function of slate.
.h
virtual FReply OnKeyDown(const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent) override;
.cpp
FReply SPSE_LYFE_PlayerUIWidget::OnKeyDown(const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent)
{
GEngine->AddOnScreenDebugMessage(-1, 5, FColor::Green, "works");
return FReply::Handled();
}
But this event doesn’t trigger. Anything specific should I do to bind this event?