mirror of
https://github.com/sinbad/StevesUEHelpers.git
synced 2025-02-23 09:35:25 +00:00
UFocusableUserWidget::NativeOnFocusReceived - call SetFocusProperly if not otherwise handled
This commit is contained in:
parent
bd9c429aae
commit
7f1d0e9c0e
@ -27,6 +27,19 @@ bool UFocusableUserWidget::TakeFocusIfDesired_Implementation()
|
||||
return false;
|
||||
}
|
||||
|
||||
FReply UFocusableUserWidget::NativeOnFocusReceived(const FGeometry& InGeometry, const FFocusEvent& InFocusEvent)
|
||||
{
|
||||
FReply Reply = Super::NativeOnFocusReceived(InGeometry, InFocusEvent);
|
||||
|
||||
if (!Reply.IsEventHandled())
|
||||
{
|
||||
SetFocusProperly();
|
||||
Reply.Handled();
|
||||
}
|
||||
|
||||
return Reply;
|
||||
}
|
||||
|
||||
void UFocusableUserWidget::NativeConstruct()
|
||||
{
|
||||
Super::NativeConstruct();
|
||||
|
@ -25,6 +25,8 @@ protected:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Focus")
|
||||
int AutomaticFocusPriority = 0;
|
||||
|
||||
virtual FReply NativeOnFocusReceived(const FGeometry& InGeometry, const FFocusEvent& InFocusEvent) override;
|
||||
|
||||
public:
|
||||
/// UWidget::SetFocus is not virtual FFS. This does the same as SetFocus by default but can be overridden,
|
||||
/// e.g. to delegate focus to specific children
|
||||
|
Loading…
x
Reference in New Issue
Block a user