[Solved] I set all displayables to keyboard_focus = False, yet one of them still gains focus via arrow key.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
[Solved] I set all displayables to keyboard_focus = False, yet one of them still gains focus via arrow key.
I set all displayables to keyboard_focus = False, yet one of them still gains focus via arrow key. Anyone know why?
NOTE: I did not disable keyboard focus of things like main_menu, preferences, save, load, and menus like that.
NOTE: I did not disable keyboard focus of things like main_menu, preferences, save, load, and menus like that.
Last edited by henvu50 on Tue Jul 13, 2021 8:00 pm, edited 1 time in total.
Re: I set all displayables to keyboard_focus = False, yet one of them still gains focus via arrow key. Anyone know why?
It would really help if you posted some code - A million things could be wrong...
Re: I set all displayables to keyboard_focus = False, yet one of them still gains focus via arrow key. Anyone know why?
Hmm okay, how about this. In Ren'py create a brand new project.
Let's add this:
Code: Select all
# SCREENS.RPY
default quick_menu = False
# -------------------
screen test3():
textbutton "Top":
xalign 0.1
yalign 0.1
keyboard_focus False
action NullAction()
textbutton "Mid":
xalign 0.2
yalign 0.2
keyboard_focus False
action NullAction()
textbutton "Bottom":
xalign 0.8
yalign 0.8
keyboard_focus False
action NullAction()
label start:
show screen test3
"this is a test"
Last edited by henvu50 on Mon Jul 12, 2021 5:32 pm, edited 2 times in total.
- Ocelot
- Lemma-Class Veteran
- Posts: 2402
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
- Contact:
Re: I set all displayables to keyboard_focus = False, yet one of them still gains focus via arrow key. Anyone know why?
Cannot reproduce. I can only switch focus between quickbar and say screen with keyboard.
Note that I had to fix tab character and inconsistent block size in your code before game could be launched.
Note that I had to fix tab character and inconsistent block size in your code before game could be launched.
< < insert Rick Cook quote here > >
Re: I set all displayables to keyboard_focus = False, yet one of them still gains focus via arrow key. Anyone know why?
I modified the code based on your suggestions and provided a more thorough example that should reproduce the problem.
- Ocelot
- Lemma-Class Veteran
- Posts: 2402
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
- Contact:
Re: I set all displayables to keyboard_focus = False, yet one of them still gains focus via arrow key. Anyone know why?
Tested new code. First time, as expected, "Bottom" button could be focused (because of keyboard_focus True). Then I set keyboard_focus to False, and again, only quick menu and say screen could be focused
EDIT: Tried again with edited version, wasn't able to move focus from say screen. Updated to the latest release version to exclude possibility of bugs in latest version, still no hits.
EDIT: Tried again with edited version, wasn't able to move focus from say screen. Updated to the latest release version to exclude possibility of bugs in latest version, still no hits.
< < insert Rick Cook quote here > >
Re: I set all displayables to keyboard_focus = False, yet one of them still gains focus via arrow key. Anyone know why?
First, I want to apologize. I don't mean to waste your time, but, I made a mistake again! I need to re-triple my efforts and focus. For some reason I forgot to include the menu code. I have no idea what could've been going through my head by not including that. I think I need to slow down, take two steps back.Ocelot wrote: ↑Mon Jul 12, 2021 5:34 pm Tested new code. First time, as expected, "Bottom" button could be focused (because of keyboard_focus True). Then I set keyboard_focus to False, and again, only quick menu and say screen could be focused
EDIT: Tried again with edited version, wasn't able to move focus from say screen. Updated to the latest release version to exclude possibility of bugs in latest version, still no hits.
With a clear head, this code should reproduce the problem, without a shadow of doubt.
Code: Select all
# SCREENS.RPY
default quick_menu = False
# -------------------
screen test3():
textbutton "Top":
xalign 0.1
yalign 0.1
keyboard_focus False
action NullAction()
textbutton "Mid":
xalign 0.2
yalign 0.2
keyboard_focus False
action NullAction()
textbutton "Bottom":
xalign 0.8
yalign 0.8
keyboard_focus False
action NullAction()
label start:
show screen test3
# i can't believe I didn't include this. THIS IS THE WHOLE REASON i raised this issue. It's important this is here.
menu:
"A":
"a"
"B":
"b"
"this is a test"
- Ocelot
- Lemma-Class Veteran
- Posts: 2402
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
- Contact:
Re: I set all displayables to keyboard_focus = False, yet one of them still gains focus via arrow key. Anyone know why?
This is interesting. It appears that first displayable in the screen gets focus (I swapped Top and Mid blocks and Mid button started to gain focus). Even more: when I set Top button keyboard_focus to True, Mid STILL was getting focus first, before Top. I will get a closer look at it later, but it seems to be a bug.
< < insert Rick Cook quote here > >
- midgethetree
- Regular
- Posts: 39
- Joined: Wed Dec 30, 2020 3:51 pm
- Completed: Back When, The Mother of Pearls, various jam games
- Projects: When Everyone's Watching, Deliberation
- Github: midgethetree
- itch: midge-the-tree
- Discord: rainafc#3353
- Contact:
Re: I set all displayables to keyboard_focus = False, yet one of them still gains focus via arrow key. Anyone know why?
I created a pull request to fix this just now, hopefully it'll be included in 7.4.7.
Re: I set all displayables to keyboard_focus = False, yet one of them still gains focus via arrow key. Anyone know why?
Thanks!midgethetree wrote: ↑Tue Jul 13, 2021 6:47 pm I created a pull request to fix this just now, hopefully it'll be included in 7.4.7.
Who is online
Users browsing this forum: No registered users