Button focus broken with tooltips

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
Post Reply
Message
Author
User avatar
timepatches
Regular
Posts: 91
Joined: Sun Aug 14, 2016 1:52 am
Completed: When Aster Falls; Were|House; DemiDato: Monster Dating Show; Grand-Nya
Projects: The Bat-Chelor
Organization: Sad Ghost Studios
Tumblr: sadghoststudios
itch: Sad Ghost Studios
Location: Australia
Contact:

Button focus broken with tooltips

#1 Post by timepatches »

I'm having an issue with the tooltip code, and I'm pretty sure this is a known bug, but in case anyone can help me!
I've added the tooltip code from the documentation into my imagebutton quickmenu.

Code: Select all

screen quick_menu():
        zorder 100

        use tooltipscreen
        hbox:
            yalign 0.637
            xalign 0.889
            spacing 9
            imagebutton:
                idle "gui/alt_save_idle.png"
                auto "gui/save_%s.png"
                action ShowMenu ('save')
                focus_mask True
                yalign 1.0
                style "main_imagebutton"
            imagebutton idle "gui/alt_load_idle.png" auto "gui/load_%s.png" action ShowMenu ('load') focus_mask True yalign 1.0 style "main_imagebutton"
            imagebutton idle "gui/alt_rollback_idle.png" auto "gui/rollback_%s.png" action Rollback() focus_mask True yalign 1.0 style "main_imagebutton" tooltip "Back one line (Mouse Wheel)"
            imagebutton idle "gui/alt_skip_idle.png" auto "gui/skip_%s.png" action Skip () alternate Skip(fast=True, confirm=True) focus_mask True yalign 1.0 style "main_imagebutton" tooltip "Skip seen text (Ctrl)"
            imagebutton idle "gui/alt_menu_idle.png" auto "gui/menu_%s.png" action ShowMenu('gamemenu_settings') focus_mask True yalign 1.0 style "main_imagebutton"

screen tooltipscreen:

        modal False
        sensitive False
        layer "master"
        roll_forward True
        $ tooltip = GetTooltip()

        if tooltip:
            text tooltip size 20 yalign 0.637 xalign 0.889 yoffset -38 outlines [(2,"#000000",0,0)]
(put the tooltip itself into another screen to see if that fixed it, but it didn't)
Focus works fine with mouse, but using either keyboard or gamepad makes the buttons completely unhoverable. They can't gain focus at all.
It's definitely the tooltips doing this. Nothing I do gives them focus (apart from default_focus True, but you still can't toggle around with the buttons, and I can't really have default focus on a quickmenu anyway), but everything works totally fine when I comment out the tooltip button attribute. Have checked this on a clean project with a new quickmenu and the error still happens.

What is really weird to me about this is that when I go to a choice menu, the button focus works totally fine.
https://youtu.be/wigiy46alBA
I don't know enough about Ren'Py's internals to figure out what exactly about the choice screen fixes this issue (I'm assuming something about default focus? but I've tried basically everything), so any help on a fix for this would be very appreciated! \o/
ImageImage Image

★☆ currently: DEMIDATO RELEASED MARCH 14 \ *°▽°* /
i appreciate honest critique!

User avatar
m_from_space
Miko-Class Veteran
Posts: 982
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Button focus broken with tooltips

#2 Post by m_from_space »

I quickly tested it and can confirm this problem inside the quick_menu screen. When using the tag "tooltip" on any imagebutton or textbutton inside it, the buttons containing tooltips cannot be selected via a gamepad.

This doesn't happen in the main_menu screen though for example.

You should create an issue here:

https://github.com/renpy/renpy/issues

P.S. better not use the variable name "tooltip" since it is a keyword in Renpy script language

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3795
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Button focus broken with tooltips

#3 Post by Imperf3kt »

m_from_space wrote: Mon Feb 20, 2023 8:29 am P.S. better not use the variable name "tooltip" since it is a keyword in Renpy script language
Their use here is as advised by the documentation, there's should be no issue using "tooltip" as a variable as that's what the example documentation shows to use.
https://www.renpy.org/doc/html/screen_a ... l#tooltips
Last edited by Imperf3kt on Mon Feb 20, 2023 3:21 pm, edited 1 time in total.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
timepatches
Regular
Posts: 91
Joined: Sun Aug 14, 2016 1:52 am
Completed: When Aster Falls; Were|House; DemiDato: Monster Dating Show; Grand-Nya
Projects: The Bat-Chelor
Organization: Sad Ghost Studios
Tumblr: sadghoststudios
itch: Sad Ghost Studios
Location: Australia
Contact:

Re: Button focus broken with tooltips

#4 Post by timepatches »

Thanks y'all! Now I know it's not just me being a colossal doofus in the code somewhere, I've posted this as a git issue here.
ImageImage Image

★☆ currently: DEMIDATO RELEASED MARCH 14 \ *°▽°* /
i appreciate honest critique!

User avatar
m_from_space
Miko-Class Veteran
Posts: 982
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Button focus broken with tooltips

#5 Post by m_from_space »

Imperf3kt wrote: Mon Feb 20, 2023 9:13 am Their use here is as advised by the documentation, there's should be no issue using "tooltip" as a variable as that's what the example documentation shows to use.
Thanks, I know it's not an issue here. But it's generally a good idea to not use keywords that can have other meanings inside code. Just for clearity when reading it later on.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]