[Solved] Renpy won't focus out of input

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
Saa
Regular
Posts: 32
Joined: Tue Aug 20, 2013 7:11 pm
Tumblr: nipahgirl
Contact:

[Solved] Renpy won't focus out of input

#1 Post by Saa » Sat May 04, 2019 6:21 pm

Hi! I'm trying to make a screen with multiple inputs (although I have encountered this issue even with one single input). My problem is, whenever I'm in that screen, focus is on the first input and it doesn't ever focus out, not even when I press Enter or click another input field. That means I have no way of editing other input fields. Whatever keys I press always affects the input and not anything else (like navigation). I found a post doing exactly what I wanted by making the input fields buttons, but it's obsolete (action input.enable doesn't work/exist anymore) and I have no idea how to make it work.

Here's my code, although the same has happened just by adding input value VariableInputValue("MCname") in the preferences screen:

Code: Select all

screen cpron():

    ## Ensure other screens do not get input while this screen is displayed.
    modal True

    zorder 200

    style_prefix "cpron"

    add "gui/overlay/confirm.png"

    frame:

        vbox:
            xalign .5
            yalign .5
            spacing 30

            label _("Custom Pronouns:"):
                style "cpron_prompt"
                xalign 0.5

            hbox:
                text "Subjective: "
                input value VariableInputValue("tempsub") length 6 allow "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ '-"
            hbox:
                text "Objective: "
                input value VariableInputValue("tempob") length 6 allow "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ '-"
            hbox:
                text "Possessive: "
                input value VariableInputValue("tempposs") length 6 allow "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ '-"
            hbox:
                text "Reflexive: "
                input value VariableInputValue("tempref") length 12 allow "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ '-"
            hbox:
                style_prefix "radio"
                textbutton _("Singular") action SetVariable("tempplu", False)
                textbutton _("Plural") action SetVariable("tempplu", True)
            hbox:
                textbutton _("Ok") action [Function(cpronouns, tempsub.strip(), tempob.strip(), tempposs.strip(), tempref.strip(), tempplu), Hide("cpron")]
                textbutton _("Cancel") action Hide("cpron")
Last edited by Saa on Sun May 05, 2019 4:15 pm, edited 1 time in total.

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

Re: Renpy won't focus out of input

#2 Post by Imperf3kt » Sat May 04, 2019 8:58 pm

Input screens are a bit special. You can only use one on a screen at a time.

A workaround is to make the input screen appear on button click and disappear on returning the value.

Im unable to give an example at the moment as my main PC is in pieces :P
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py

User avatar
Saa
Regular
Posts: 32
Joined: Tue Aug 20, 2013 7:11 pm
Tumblr: nipahgirl
Contact:

Re: Renpy won't focus out of input

#3 Post by Saa » Sun May 05, 2019 7:19 am

That makes a lot of sense, thank you! I tried doing as you said and it works wonderfully, but I'm pretty sure it's way less efficient than it could be so if you get the chance once you have your computer back (even if it takes months), I'd love to see those examples! It's fine if you forget though, the game is working either way thanks to you :D

Post Reply

Who is online

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