Page 1 of 1

How do I disable key focusing on quick menu?

Posted: Thu Jun 07, 2018 9:49 pm
by HyDrone
I'm using left and right on the keyboard to move back and forward in my project. For this build, I would like to disable access to the quick menu via arrow keys, primarily so that the quick menu won't be focused by accident, which would make the user have to click more than once in order to advance. How should I do that? I've been browsing the scripts, and all of relevance I've found so far are key bindings and the text that controls which functions appear in the quick menu.

* (A better system that allows the user to switch between forward/back mode and quick menu mode is planned for later, but I'm making a demo, and there would be no need to have quick access for configurations/saves anyway, so for now I'd just prefer to limit the access for simplicity.)

Re: How do I disable key focusing on quick menu?

Posted: Fri Jun 08, 2018 3:23 am
by kivik
Check out this page: https://www.renpy.org/doc/html/keymap.html

There's an example of how to add and remove keys to an event, but let us know if you get stuck :)

Re: How do I disable key focusing on quick menu?

Posted: Fri Jun 08, 2018 3:38 am
by Remix
Find the screen in screens.rpy and amend the buttons to include the attribute:

keyboard_focus - False

Code: Select all

    textbutton _("Q.Save") action QuickSave() keyboard_focus False
It also might be possible (and easier) to add it to the quick_button style

Re: How do I disable key focusing on quick menu?

Posted: Fri Jun 08, 2018 1:19 pm
by HyDrone
Thank you both!

kivk: I went with

Code: Select all

    $config.keymap['focus_up'].remove('K_UP')
    $config.keymap['focus_up'].remove('repeat_K_UP')
for all directions, and that seems to work well, though it would be even better if I could still allow the movement in the main menu.

Remix: I tried that method. It works almost, but not quite. It looks like it prevents individual buttons from being selectable among one another, but it doesn't prevent the quick menu itself from being selected, so the leftmost button could still be focused (at least that's how it seems when I tried with different numbers of buttons and the style method).

Re: How do I disable key focusing on quick menu?

Posted: Sun Jun 17, 2018 10:48 pm
by PyTom
For the record; don't do this. The keyboard is necessary for accessibility for players that can't reliably use a mouse.