Page 1 of 1

Adding a scrollbar [SOLVED]

Posted: Mon Jan 05, 2015 10:43 pm
by Llunet1
Hello! I'm trying to add a scrollbar into a screen. It's an information journal, an in order to avoid making pages (in case it goes over), it would be much better to be able to scroll!
Does anyone know how to do this?
Also, I'm going to be inputting all the writing in the screen. Will the text function work? Or is there another way to input the text?

If there isn't a way to do this, I can just avoid to go over, or simply make pages.

Thank you! :)
(Here's a diagram of what I'm trying to do)

Re: Adding a scrollbar

Posted: Tue Jan 06, 2015 4:58 pm
by Dragonstar89
You can use Ren'Py's "Frame" code to add a scrollbar. For example, I added the code to my Music Room list to make the vbox list have a scrollbar. You could start out like this:

Code: Select all

    frame:
        side ("c r"):
            area (1,0,280,600)
            viewport id "music_list":
                draggable True mousewheel True
Then, after all of your text/inner content has been defined, use this:

Code: Select all

vbar value YScrollValue("music_list")
(but make sure it stays indented within the "viewport" block. Basically, a full section of code could look like this:

Code: Select all

    frame:
        side ("c r"):
            area (1,0,280,600)
            viewport id "my_scroller": #REMEMBER YOUR VIEWPORT ID SO THE SCROLLBAR IS PLACED FOR IT
                draggable True mousewheel True
                     text "this is my text."
                     textbutton "This is my Button" action Start()
            vbar value YScrollValue("my_scroller") #TAKES YOUR VIEWPORT ID AS THE ARG
    null height 20 #just a height set.
However, this is just how to do it in barebones. The official documentation has a much better explanation and example on things like what "side("c r")" is, what to use null height for, etc. Also this won't mess up your text. You can still display your text like any other screen. I forgot to mention that in a screen, (IIRC) you have to use

Code: Select all

text "my text here"
to display text because it is the screen code.

Re: Adding a scrollbar

Posted: Tue Jan 06, 2015 11:14 pm
by Llunet1
Thank you so much! I finally got it to work~

Re: Adding a scrollbar [SOLVED]

Posted: Tue Jan 06, 2015 11:24 pm
by Llunet1
Actually. The text isn't showing up. So, while the scrollbar is there... there seems to be nothing in it?

*Edit* Figured out what the problem was. The text statements should be on the same indent as the "draggable True..." line.
Once again, thank you~

Re: Adding a scrollbar [SOLVED]

Posted: Wed Jan 07, 2015 4:41 pm
by Dragonstar89
Llunet1 wrote:Actually. The text isn't showing up. So, while the scrollbar is there... there seems to be nothing in it?

*Edit* Figured out what the problem was. The text statements should be on the same indent as the "draggable True..." line.
Once again, thank you~
Yeah, sorry I forgot to mention that. You'r welcome :)

Re: Adding a scrollbar [SOLVED]

Posted: Wed Sep 13, 2023 3:57 pm
by smrg
I'm trying to do it but I can't scroll down to see text below the seeing range

Code: Select all

screen quiz:
    add "wood.jpg"
    frame:
        xpos 200
        side ('c r'):
            area (0,0,1280,720)
            viewport id "quiz_sheet":
                draggable True mousewheel True
                add "sheet.jpg"
                text _("""{color=000}Sample text{/color}""")
                textbutton "Yes" ypos 100
                text _("{color=000}This is far below{/color}") ypos 1000
            vbar value YScrollValue("quiz_sheet")