How can one create working HUD button without losing focus in game?

This is getting weird, I have multiple projects using UMG but issues with focus are just weird… I belive focus system needs some attention… Right now I don’t know how to make HUD button which does not take focus after clicking on it. When I click on the button I need to click again at empty place in order to be able to control pawn again. (yes I have bFocusable set to false and Input mode does not help here)… also I have checkbox in my HUD screen and when I click that and then I try to jump using Space bar, my checkbox is toggled again (just like it was selected somehow and pressed by space bar)… I had much less problems with good old Canvas and custom framework in UE3 :confused:

Make sure nothing is focusable. UserWidgets and buttons default to focusable, so uncheck that option. We’ve found the default for user widgets especially problematic, we’re going to make them non-focusable by default in 4.11 (old content will remain unchanged). Buttons will continue to be focusable, but we’ll keep thinking of a way to improve this when focusable elements are used in touch environments. I’ve considered making it impossible for touch to give things focus in Slate, but I’m fairly certain that would just be wrong in the opposite direction.

Canvas wasn’t a UI framework, Slate is. So it’s going to be more complex because it has to handle a lot more cases.

Thank you so much for your active participating in community Nick, It is amazing that we are in contact with main UMG dev. Do you have any idea how to make checkbox not focusable ? For me, the problems looks quite simple but I am not sure how to fix it…

I have checkbox at main HUD screen, when I click that my game lose focus, so pawn does not move anymore… when I click back to empty place my game regains focus and I can control pawn again, however when I press Space Bar last pressed checkbox is activated again … so actually, there are two issues: Game loses focus, chechbox is reactivated by Space Bar

I can’t see “focusable” toggle in properties of checkbox

Looks like it wasn’t exposed. As a workaround you can force the focus to return to the viewport with SetFocusToGameViewport.

Thanks, will check it out, can we expect it to be exposed in future ?

Yeah. (adding more characters so my response is at least 10 characters)

In 4.11 I encountered an issue related to focusing on the game viewport vs UMG widgets using Set Input Mode : Game and UI, while searching for help (before figuring it out) I found this to be top post on google, so I am posting my solution here in case it will help someone!

UMG: Game and UI, game viewport loses focus after a single click
https://answers.unrealengine.com/questions/398336/411-umg-game-ui-focus-after-a-single-click-on-view.html

:heart:

Rama

So I was having focus issues around animating (re-sizing) widgets that parent a button. It seems that “focus-out” behaviour doesn’t get triggered and the UI treats the button still in focus (regardless if set to not focusable). My solution was to bind a function to an image inside the button and not use the button event. Button hover styles can still be applied.