[SOLVED] Scrollbar in menu choices

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
InsaneGamer
Newbie
Posts: 8
Joined: Sun Apr 02, 2023 2:16 pm
Contact:

[SOLVED] Scrollbar in menu choices

#1 Post by InsaneGamer »

Hey, guys! I'm trying to do a scrollbar in the menu choices.

First, I put my choices into the textbox. Then, I put the code "draggable" and "mousewheel" but still didn't work.

Like this:

Code: Select all

screen choice(items):
    style_prefix "choice"

    if line_length <= 57: 

        if len(items) >= 3: #itens nas escolhas muitos
            viewport:
                draggable True
                mousewheel True
                scrollbars "vertical" 
                
                xsize 800 
                ysize 150 
                xpos 250 
                ypos 450 

                vbox:
                    for i in items:
                        textbutton i.caption action i.action

        else:
            vbox:
                xpos 250
                ypos 500 
                for i in items:
                    textbutton i.caption action i.action

    else:
        if len(items) >= 2:
            viewport:
                draggable True
                mousewheel True
                scrollbars "vertical"

                xsize 800 
                ysize 150 
                xpos 250
                ypos 450

                vbox:
                    for i in items:
                        textbutton i.caption action i.action

        else:
            vbox:
                for i in items:
                    textbutton i.caption action i.action 
Look how it looks like:

IMAGE ===> https://64.media.tumblr.com/526f1cbc1c3 ... ca7414.pnj

Someone can help me to put a scrollbar here? Thanks!
Last edited by InsaneGamer on Thu Jul 06, 2023 5:42 pm, edited 1 time in total.

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2447
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Scrollbar in menu choices

#2 Post by Ocelot »

You need to limit size of viewport. You won't get a scrollbar if viewport is large enough to accomodate content (even if some parts will be offscreen)
< < insert Rick Cook quote here > >

InsaneGamer
Newbie
Posts: 8
Joined: Sun Apr 02, 2023 2:16 pm
Contact:

Re: Scrollbar in menu choices

#3 Post by InsaneGamer »

Sorry, I didn't understand where I must change the code.

xsize 800
ysize 150 >>>>> this one should'nt limit the size of the viewport? I tried to change, but nothing happens.
xpos 250
ypos 450

My game is 1066 x 600.

InsaneGamer
Newbie
Posts: 8
Joined: Sun Apr 02, 2023 2:16 pm
Contact:

Re: Scrollbar in menu choices

#4 Post by InsaneGamer »

Oh, nevermind! I was in the right track. Just needed to put a samll number in ysize

Thank you!

Post Reply

Who is online

Users browsing this forum: No registered users