I have a UMG blueprint parented to a custom c++ class which in turn is parented to UUserWidget. I need my c++ class to receive KeyDown events. I tried to do an override, but it's not working. Is it possible for a UMG BP or its parent to get KeyDown events?
Announcement
Collapse
No announcement yet.
Receiving KeyDown events in UMG?
Collapse
X
-
Just to check the basics first, when overriding, you used the BlueprintNativeImplementation function, like so?
Code:virtual FEventReply OnKeyDown_Implementation( FGeometry MyGeometry, FKeyboardEvent InKeyboardEvent ) override;
Make sure the widget's bSupportsKeyboardFocus is true (the default). You might have to call SetKeyboardFocus on the widget manually, but Slate (and therefore UMG) is generally smart about this.
Also, make sure your input mode isn't GameOnly (through APlayerController::SetInputMode), as this is usually for HUDs or other UIs you never want to interact with.
-
Originally posted by Whammy View PostBlueprintNativeImplementation doesn't like a virtual tag on the declaration.
(If you do have a Blueprint implementation, you can still call the generated C++ function by right clicking the Blueprint implementation and choosing "Add call to parent function".)
Comment
Comment