[SOLVED] Adjusting scrollbar position in vbox

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
ohprocrastinator
Newbie
Posts: 22
Joined: Thu May 23, 2013 8:44 am
Contact:

[SOLVED] Adjusting scrollbar position in vbox

#1 Post by ohprocrastinator »

Hi!

I'm currently trying to make some kind of file records screen where the player can click on a file name and read the information in it.
I've made a vbox containing the information text, but I can't seem to change the position of the scrollbar.

Here's what it currently looks like (the scrollbar is very close to the text)
records.png
records.png (360.9 KiB) Viewed 24948 times

And there's what I want it to look like (the scrollbar has distance with the text)
records2.png
records2.png (355.87 KiB) Viewed 24948 times

I've tried changing the xminimum/xmaximum, area etc but it only change the size of the overall vbox.
Here's what my code looks like:

Code: Select all

frame:
    style_prefix "records"
    background None
    area (913,165,600,750)

    if book == "book1":

        vpgrid:
            yinitial 0.0
            cols 1
            mousewheel True
            draggable True
            scrollbars "vertical"

            vbox:
                text "This is book1."

    elif book == "book2":
        vpgrid:
            yinitial 0.0
            cols 1
            mousewheel True
            draggable True
            scrollbars "vertical"

            vbox:
                text "This is book 2."
Thanks in advance!
Last edited by ohprocrastinator on Fri Jan 12, 2024 11:54 pm, edited 1 time in total.

User avatar
m_from_space
Miko-Class Veteran
Posts: 975
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Adjusting scrollbar position in vbox

#2 Post by m_from_space »

Many different ways, an easy one being to put the text into a frame with right-side padding:

(You don't need a vbox if you only put one element inside it by the way, just a hint.)

Code: Select all

frame:
    background None
    # (left, top, right, bottom)
    padding (0, 0, 50, 0)
    xfill True
    vbox:
        text "This is book1."

User avatar
ohprocrastinator
Newbie
Posts: 22
Joined: Thu May 23, 2013 8:44 am
Contact:

Re: Adjusting scrollbar position in vbox

#3 Post by ohprocrastinator »

the vbox will have longer text, it's just a placeholder :) thanks for the help

Post Reply

Who is online

Users browsing this forum: Google [Bot]