[Bug] hyperlink_focus fails in draggable viewports etc

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
jeffster
Veteran
Posts: 361
Joined: Wed Feb 03, 2021 9:55 pm
Contact:

[Bug] hyperlink_focus fails in draggable viewports etc

#1 Post by jeffster »

When custom style.hyperlink_functions[2] is set, it's supposed to run on hyperlinks hover. It doesn't happen if the hyperlink is inside a button or a draggable viewport.

In such cases only unhovering works (hyperlink_focus(None) runs), but it doesn't run on hovering.

Test code:

Code: Select all

init python:
    test_mess = ""

    def my_hyperlink_sensitive(target=None):
        global test_mess
        if target:
            test_mess += "Focusing in " + target + ". "
        else:
            test_mess += " Unfocusing. "
        renpy.restart_interaction()

    style.default.hyperlink_functions = (
        hyperlink_styler,
        hyperlink_function,
        my_hyperlink_sensitive)

screen test_link():
    frame background None:
        vbox spacing 36:
            viewport id "vp":
                ysize 48
                text "A {a=viewport}link{/a} in viewport (works well)."
            viewport id "vp2":
                ysize 48
                draggable True
                text "A {a=draggable viewport}link{/a} in draggable viewport (only from above)."
            textbutton "A {a=textbutton}link{/a} in textbutton (doesn't work).":
                action Return()
            text test_mess

label main_menu:
    return
label start:
    call screen test_link
    "End"
Funny thing that hyperlink_focus runs on a link in a draggable viewport if the mouse is moved there from above, but doesn't work if moving in from other three directions.

Tested on desktop. Why do I want it to work? To change the mouse cursor hovering hyperlinks. Yes, I use complex layouts like hypertext on text buttons and in draggable viewports.

Post Reply

Who is online

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