Auto enable/disable scrollbar on viewport

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
rames44
Veteran
Posts: 233
Joined: Sun May 29, 2016 4:38 pm
Contact:

Auto enable/disable scrollbar on viewport

#1 Post by rames44 »

Given a viewport on a screen that contains a vbox, where the vbox will have a variable number of items, where the items themselves will be of variable height.

Is there a way to automatically detect whether the child content of the viewport (i.e. the vertical height of the vbox) exceeds the viewport size and automatically enable/disable the vertical scrollbar on the viewport based on this? Visually, I would like to have the scrollbar appear when the viewport is scrollable, but be hidden when it isn't needed.

(Apologies if this is already covered here somewhere - my Google Fu wasn't up to finding it.)

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Auto enable/disable scrollbar on viewport

#2 Post by PyTom »

Yes, that's the purpose of the "unscrollable" property.

https://www.renpy.org/doc/html/style_pr ... scrollable
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot], piinkpuddiin, Semrush [Bot], snotwurm