Scrollbar won't pair with viewport contents.

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
paulyboyx
Newbie
Posts: 11
Joined: Thu Mar 10, 2022 1:20 am
Contact:

Scrollbar won't pair with viewport contents.

#1 Post by paulyboyx »

I've tried for many frustrating hours now to put a scrollbar on a viewport. Yes, I've read through the documentation and googled similar issues, but nothing has worked.

My code is below. I have to contain the contents of the viewport (the contents that I want to be scrollable) in boxes. Otherwise, for some reason they all appear layered on top of one another. Yet then when I try to add a vertical bar to scroll the contents, depending where in the code I put the bar, either it appears over top of the contents, or the length of the bar is much shorter than required, or the bar appears after the contents, or the bar doesn't appear at all.

Thanks for taking a look.

Code: Select all

screen goals(): 

    tag menu

    use game_menu(_("Goals"))

    vbox:

        xalign .6

        use goalsFilterPick()

        viewport id "vp":
            draggable True
            mousewheel True
            arrowkeys True
            pagekeys True
            anchor (0,0)
            align (.25, .09)
            hbox:
                xsize 1350
                vbox:
                    #CONTENTS GO HERE
                vbox:
                    vbar value YScrollValue("vp") #[u]WON'T PAIR WITH CONTENTS OF OTHER VBOX

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

Re: Scrollbar won't pair with viewport contents.

#2 Post by m_from_space »

paulyboyx wrote: Sun Nov 26, 2023 5:19 pm I've tried for many frustrating hours now to put a scrollbar on a viewport. Yes, I've read through the documentation and googled similar issues, but nothing has worked.
Have you read about how to properly implement a viewport with scrollbars? Here is the reference: https://www.renpy.org/doc/html/screens.html#viewport

You don't need a vbar for it, but if you do so, you have to place it outside of the viewport of course. You did place it inside the viewport. But here is a simpler way:

Code: Select all

viewport:
    scrollbars "vertical"
Otherwise, for some reason they all appear layered on top of one another.
This is normal. You have to tell Renpy how to arrange it using hbox or vbox or any other method of positioning (like absolute or relative positions).

Post Reply

Who is online

Users browsing this forum: Google [Bot], inkacorn, SONTSE