Get Focused Widget?

Theres no way to Get Focused Widget? I just found on widget blueprints the Has Focus node that only works if used with a constant check tick :’(

I think there is no method that will retrieve your focused widget, but if you are the owner of the method that is setting a widget in the viewport, you can always store a reference of the last widget on screen to work later with it.

As soon as you create a widget from Class, store the return value in a local variable, and then add it to the viewport.

I often do this, helps a lot in future developments.

I need get the focused widget from navigation with gamepad or keyboard, so the stored initial widget won’t work for that usage, thanks anyway

You can do it exactly like that, with a tick, the problem is, that you must have something like

Every tick
“Does this have focus?” “No.”
“Does this have focus?” “No.”
“Does this have focus?” “No.”
“Does this have focus?” “Yes” Store focused into a variable, and every tick set your focus into the selected widget.

And you ask for every widget. If you dont want the mouse to change the focus, you override the on mouse button down function to set the focus in the stored focus.

It might not be the best way, thats for sure, but is one way to do it. Im also looking for a way to disable mouse click, and at the moment this is the best i have come. Still looking for a more optimal way to do it.

I wrote for support asking to them add it as function, waiting they answer.

I found a partial solution for this.
FSlateApplication::Get().GetUserFocusedWidget(0);

Hey, you could use the approach described here, for example: How to get the currently focused widget in Unreal Engine | Georgy's Tech Blog