Download

Questions regarding widget focusing

Hello! I have some relatively simple questions:

  1. When a widget has focus from the keyboard or gamepad, it has little border around it. What is that called? (So I can research how it works)
  2. Since I can’t set it in UMG, is there an easy way to change its styling in C++ with Slate?
  3. When I call “Set Focus” on a widget, the border doesn’t appear, but when it is selected by pressing an arrow key, it does appear. How can I make it appear when I call “Set Focus”?

You don’t have to answer all the questions. Thanks for your time.

It’s usually called “focus outline” or something along those lines. You can also decide whether or not it should show up by going to the project settings → user interface → render focus rule.

There is probably a way to change its styling in Slate, I don’t know about “easy”, though. I imagine Slate uses a 9-patch to render the outline, so you could try to find that in the UE4 directory and replace it with an image of your own. No idea if it’ll work. Styles for Slate widgets are often defined right in code in style structs. Look at FEditorStyle in the engine source for an example. Overriding this without modifying the engine is kind of a hassle.

There’s SetFocus, SetUserFocus, and SetKeyboardFocus. Do none of them cause the outline to appear?

1 Like

Thanks, man! Setting “Render Focus Rule” to “Non-Pointer” makes the outline appear from navigation an manual focus-setting but not from the mouse.

Thanks for the help!