How to change ui.input into a button?

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.
Message
Author
philat
Eileen-Class Veteran
Posts: 1853
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: How to change ui.input into a button?

#16 Post by philat » Sat Mar 14, 2015 1:11 pm

I presume what OP wants is multiple input fields that the user can click on to focus and type in directly in the field. Roughly similar to what is described here: http://lemmasoft.renai.us/forums/viewto ... =8&t=29210

I have nothing to add to the conversation in terms of how to do it (never thought about it), but thought since this thread is going in circles...

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: How to change ui.input into a button?

#17 Post by namastaii » Sat Mar 14, 2015 1:39 pm

Wait, that's where I got my original ui.input idea anyway, but nobody could help that guy either D:

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: How to change ui.input into a button?

#18 Post by namastaii » Sat Mar 14, 2015 1:46 pm

Code: Select all

hbox xpos 200 ypos 200:
        vbox:
            frame:
                hbox:
            
                    input default "hi"
                    $ first_name = input
This works. with a button look. BUT if i add focus like so:

Code: Select all

hbox xpos 200 ypos 200:
        vbox:
            frame:
                hbox:
            
                    focus input default "hi"
                    $ first_name = input
It turns into a tiny dot and it doesn't work

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: How to change ui.input into a button?

#19 Post by xela » Sat Mar 14, 2015 1:50 pm

So what you want is textbox that is always visible that you can type into at any time just by clicking on it?
Like what we're doing? Support us at:
Image

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: How to change ui.input into a button?

#20 Post by xela » Sat Mar 14, 2015 2:08 pm

You could try something like this:

Code: Select all

init python:
    def func(newstring):
        store.var = newstring

screen input_testing():   
    input default "hi" changed func
    
label start:
    $ var = "meow"
    show screen input_testing
    "[var]"
    "[var]"
    "[var]"
    "[var]"
    "[var]"
    "[var]"
    "[var]"
    "[var]"
It will not freeze the game and you can type whenever you please.
Like what we're doing? Support us at:
Image

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: How to change ui.input into a button?

#21 Post by xela » Sat Mar 14, 2015 2:35 pm

This works really well:

Code: Select all

init python:
    def func(newstring):
        store.var = newstring

screen input_testing():
    button:
        id "Meow"
        xysize (300, 25)
        action NullAction()
        add Input(default=var, changed=func, button=renpy.get_widget("input_testing", "Meow")) yalign 1.0
    
label start:
    $ var = "Meow"
    show screen input_testing
    "[var]"
    "[var]"
    "[var]"
    "[var]"
    "[var]"
    "[var]"
    "[var]"
    "[var]"
Like what we're doing? Support us at:
Image

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: How to change ui.input into a button?

#22 Post by xela » Sat Mar 14, 2015 2:40 pm

namastaii wrote:The problem with that is that is ren'py language. Which means I can't mix the ui python screen with ren'py statements. Plus, that input statement doesn't have button capability XD
And you can mix them... there is absolutely nothing preventing that. It's just that ui module is pretty much obsolete at this point and ui.input is nothing but a reference to Input class from behavior file anyway.
Like what we're doing? Support us at:
Image

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: How to change ui.input into a button?

#23 Post by namastaii » Sat Mar 14, 2015 5:56 pm

Thank you, I'm about to try it out.

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: How to change ui.input into a button?

#24 Post by namastaii » Sat Mar 14, 2015 6:10 pm

Image
weird

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: How to change ui.input into a button?

#25 Post by namastaii » Sat Mar 14, 2015 6:11 pm

hold on,I think i know why XD

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: How to change ui.input into a button?

#26 Post by namastaii » Sat Mar 14, 2015 6:12 pm

Thank you. It only works when the mouse is hovered over it though. Is that kinda weird?

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: How to change ui.input into a button?

#27 Post by namastaii » Sat Mar 14, 2015 6:33 pm

Yeah, instead of clicking on it, i have to put my mouse over it but if i move the mouse, i can't type in it anymore XD weird, since it says button...

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: How to change ui.input into a button?

#28 Post by xela » Sat Mar 14, 2015 11:03 pm

namastaii wrote:Yeah, instead of clicking on it, i have to put my mouse over it but if i move the mouse, i can't type in it anymore XD weird, since it says button...
I wrote earlier that it's how it is coded to work...
Like what we're doing? Support us at:
Image

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: How to change ui.input into a button?

#29 Post by namastaii » Sat Mar 14, 2015 11:06 pm

Ah, okay. Do you know how I could make it so even if it's not focused on a text input, that it'll still be focused on the last one it WAS focused on so if they do type something it will appear in the last box they had selected? the only reason i ask is because thats how Magical Diarys character creation screen is like. But if not, I'm sure it's not a big deal. I really appreciate you fixing this for me thanks ^^

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: How to change ui.input into a button?

#30 Post by xela » Sat Mar 14, 2015 11:52 pm

I once again do not understand what you're asking :)

I'll download the demo to see how it works there...
Like what we're doing? Support us at:
Image

Post Reply

Who is online

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