VPGrid not scrolling [Solved]

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
mtermik
Regular
Posts: 28
Joined: Fri Dec 23, 2022 2:26 pm
Contact:

VPGrid not scrolling [Solved]

#1 Post by mtermik »

I have a vpgrid on a screen with the following initialization:

Code: Select all

vpgrid:
        cols 1
        xpos 800
        ypos 257
        spacing 10
        xsize 310
        ysize 400
        draggable True
        mousewheel True
        anchor(0.5, 0.0)

        vbox:
            xsize 270

            text "Active Tasks" style "task_section_header"

        vbox:
            spacing 10
            
            for main_quest in filter(lambda quest: quest.type == QuestType.Main, player_character.get_active_quests()):
                vbox:
                    hbox:
                        spacing 10
                        vbox:
                            xsize 25
                            add "/ui/overlays/icons/star.png" xpos 10 ypos 3
                        vbox:
                            xsize 245
                            text main_quest.key style "task_name"
                            text main_quest.get_current_step().description style "task_text"

            for side_quest in filter(lambda quest: quest.type == QuestType.Side, player_character.get_active_quests()):
                vbox:
                    hbox:
                        spacing 10
                        vbox:
                            xsize 25
                        vbox:
                            xsize 245
                            text side_quest.key style "task_name"
                            text side_quest.get_current_step().description style "task_text"


            vbox:
                xsize 270

                text "Inactive Tasks" style "task_section_header"

            for quest in player_character.get_inactive_quests():
                vbox:
                    hbox:
                        spacing 10
                        vbox:
                            xsize 25
                        vbox:
                            xsize 245
                            text quest.key style "inactive_task_name"
                            text quest.get_current_step().outcome style "inactive_task_text"
However, the vbox fails to scroll even when the information contained within becomes to large to display in the inital ysize. Am a missing a setting or is it possibly due to the vboxes?

UPDATE:

After a bit of trial and error I was able to resolve the issue as well as determine what caused the issue in the first place, or so I think. Each vbox was being treated as a child of the vpgrid and thus, depsite having only one column, it was attempting to distribute the height of the grid between them all. Encapsulating the code in a single vbox inside of the vpgrid, means it doesn't have to try and distribute the height between multiple children and allows it to scroll properly.

Code: Select all

vpgrid:
        cols 1
        xpos 800
        ypos 257
        spacing 10
        xsize 310
        ysize 400
        draggable True
        mousewheel True
        anchor(0.5, 0.0)

        vbox:
            xsize 270
            spacing 10

            text "Active Tasks" style "task_header"
            
            for main_quest in filter(lambda quest: quest.type == QuestType.Main, player_character.get_active_quests()):
                vbox:
                    hbox:
                        spacing 10
                        vbox:
                            xsize 25
                            add "/ui/overlays/icons/star.png" xpos 10 ypos 3
                        vbox:
                            xsize 245
                            text main_quest.key style "task_name"
                            text main_quest.get_current_step().description style "task_text"

            for side_quest in filter(lambda quest: quest.type == QuestType.Side, player_character.get_active_quests()):
                vbox:
                    hbox:
                        spacing 10
                        vbox:
                            xsize 25
                        vbox:
                            xsize 245
                            text side_quest.key style "task_name"
                            text side_quest.get_current_step().description style "task_text"


            text "Inactive / Completed Tasks" style "task_header"

            for quest in player_character.get_inactive_quests():
                vbox:
                    hbox:
                        spacing 10
                        vbox:
                            xsize 25
                        vbox:
                            xsize 245
                            text quest.key style "inactive_task_name"
                            text quest.get_current_step().outcome style "inactive_task_text"

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Alex, Google [Bot]