UserWidget OnKeyDown C++

Hey there, if you check the definition of that function in UUserWidget you’ll notice that is not virtual so you can’t really override it.

UFUNCTION(BlueprintImplementableEvent, BlueprintCosmetic, Category="Input")
FEventReply OnKeyDown(FGeometry MyGeometry, FKeyEvent InKeyEvent);

I am able to handle keyboard input in my menu using blueprint, but when I try to transfert my logic to c++, my game wont compile.

Here is the function in my header :

public:
    UFUNCTION()
    FEventReply OnKeyDown(FGeometry MyGeometry, FKeyEvent InKeyEvent);

here is the implementation:

FEventReply UInGameMenu::OnKeyDown(FGeometry MyGeometry, FKeyEvent InKeyEvent)
{
  UE_LOG(LogTemp, Warning, TEXT("Hello :)"))
  
  return FEventReply(true);
}

I get a linker error without much details on compilation. Am I using it wrong?

So how would I go about handling keydown event?
In blueprint you override the onkeydown event.

You override:

virtual FReply NativeOnKeyDown( const FGeometry& InGeometry, const FKeyEvent& InKeyEvent );