WIDGET SWITCHER GET FOCUS FOR GAMEPAD

Well, I do things without using the focus, I am a little bit manual in these things. There is couple of things I should mention developing an interface in UMG compared to other development environments.

A Focus : An object can be interacted by any input.
A Hover : An object is interacted but not selected yet.
A Selected : An object is interacted and now is active.(UE is generally missing this cause this state of an interactable is pressed and selected with respect to its peers, its common in lists, radiobuttons)

A Selected is missing generally in UMG and is common to have misconception between this state of an interactable widget. We can see many problems regarding this in the forums.

EX: You have a widget for password input.

  • Normally LoginScreen has focus and you can use buttons.
  • When you click password text area to edit, now password textbox has focus
  • And suddenly you lost keyboard from LogicScreen they act on TextWidget.
  • You write your pass and on enterfunction: SetFocus back to LoginScreen and everything back to normal.

Best practice that would work for any input method to handle navigation. Imagine a more complex menu system like an options. There is a vertical list, there is horizontal menu, maybe some other buttons or sections, also a back button maybe.

Having those navigation usable with focus would be hard to nail down. Instead
OnTabMenuChangeInput(NavigateLeft)->SetSelectedItem(CurrentItem+1) type of logic would be the best. You can set your buttons to not focusable that time.
OnNavigateDown->SetSelectedToList(First)

These kind of logic would save you time so that you UI navigation becomes independent from the hardware input. NavigationDown doesn’t care what button is pressed.So you don’t have to change focus on widget all the time and set buttons or buttonwidgets isFocusable=false.

Don’t want to confuse you but for a demo of how to handle things without focus is something like below. I have a tab menu some widgets/buttons inside.

When I press a buttons (with any input) an event occurs->Menu Pressed->Deselects All (Style change)
After I get the selected item and highlight that one (style change)
And you can do more things like content tab change or whatever without using focus so try to avoid it.

image

Here is what happens in SelectMenuItem

My menu systems is hypermodular so don’t get stuck with my overengineering architecture. A focus is a focus, focus on main container and do focus changes if its necessary.