I’m trying to create the UI for my game and I’ve run into a problem I just can’t crack. Everything works spectacularly with a mouse, but trying to add keyboard navigation is a nightmare. I split my issues into a few points.
By default navigation is done with the arrow keys, tab, shift+tab and enter to select. While it works fine, I couldn’t find an option anywhere to override these buttons. I also tried making other buttons mimic these actions (pressing W to navigate up, while keeping the defaults as well), but I came up empty again. Ideally I would like to change the bindings at runtime quite often, because some menus can be navigated with up/down, but lists require next/previous for the same effect.
2: Focus events.
I found no way to bind an event to a button’s OnFocusReceived. Now I could possibly create my own button class in c++ that exposes this functionality, but it feels like it should be a part of the engine.
Focused widgets have a dashed outline. This can be configured to always show, sometimes or never. Apparently its appearance can be changed somewhere in the engine’s source code. Either way, that’s probably not what should be used in a serious game, anyway. So the better alternative would be to set the object’s appearance to the hovered stlye when it’s in focus. Again, I guess this is possible from c++ if we create a new button class, that sets the style when it receives/loses focus.
There is no way to set an other widget’s IsFocusable from blueprint. I might have a button that should only be clickable/focusable under specific circumstances, like after you select an item from a grid. Widgets can set their own IsFocusable-s whenever they want, but they can’t tell other widgets to do this. So yet again, I’d have to create a new button class that has a public function for setting this value.
I wrote a function to try to solve this, but it had no effect. I wonder if it’s possible to do somehow.
At this point my best option seems to be creating my own system for UI navigation, but I wanted to ask here if I missed something before I do that.