Using Only Keyboard Inputs on Widgets

I created main menu that simply only have “Start”, “Settings” and “Quit” buttons. I can do whatever I want via mouse, but I do not want to use mouse for main menu. I want to cycle between options with Up and Down keys.

Frankly, I have no clue on how to do it. I searched online but found nothing that will help me with this. I considered creating a box player and moving it between the options, but it would be too much work and extremely buggy. What can I do in this instance?

1 Like

Any widget can lead to any other widget:


I mean, if you used buttons (as most people do), the keyboard navigation already works by default. There’s no need to do anything special.

  • widget

  • add and set focus to the button you need to start with:


You’d only set up navigation for more complex scenarios, like:

cycle between options

The last button now leads to first, so you can keep mashing :arrow_down: to cycle.

2 Likes

I did exactly like you said, still, nothing happens. I set the keyboard focus on the first button, and also set the button visibility to “non-hit testable” for disabling mouse movement. But nope, nothing happens. I can not focus on any of the buttons.

Well, that would disable any and all interaction. A button needs to be Visible to be interactive. Any widget can decide whether and which cursor needs showing:

image

You sir, are a gem. It works, though when I click on the simulation to get rid of the cursor, focus is lost. I tried assigning widget focus to Play button whenever mouse clicks anywhere but that didn’t seem to work.

And I also end up with this ugly frame around the button. I remember it could be disabled from project settings but could not find it.

Lastly, focusing on a widget does not actually show the hovering over image for it. I am now going to try manually writing the up and down functions and set the hovering over image after it.