Page 1 of 1

Vbox in screen seems to... move around? [SOLVED!]

Posted: Thu Apr 25, 2024 12:43 am
by Yone28
Hello all! I have the following screen:

Code: Select all

screen journal_incomplete:
    modal True
    zorder 998
    add "journal_background" xalign 0.5 yalign 0.5
    add "journal_header" yalign 0.05 at backbut_resize
    imagebutton:
        yalign 0.05
        auto "header_back_%s"
        action [Hide("journal_incomplete"), Show("game_ui"), Show("time_screen")]
        at backbut_resize 
    hbox:
        xalign 0.5
        yalign 0.179
        spacing 75
        textbutton "{color=#e91e1e}Incomplete" action [Hide("journal_incomplete"), Show("journal_incomplete")] text_style "textbutton"
        textbutton "Completed" action [Hide("journal_incomplete"), Show("journal_complete")] text_style "textbutton" 

    vbox:
        xpos 115
        ypos 315
        if urge_quest in a.journal and urge_quest.completed == False:
            textbutton "{size=28}{font=SyneTactile-Regular.ttf}The Urge" align (0.5, 0) action [SetVariable("current_quest_text", "urge")] text_style "quest_text"
        if melodie_quest in a.journal and melodie_quest.completed == False:
            textbutton "{size=28}The Shy Lily" align (0.5, 0) action [SetVariable("current_quest_text", "melodie")] text_style "quest_text"
        if mitsuha_quest in a.journal and mitsuha_quest.completed == False:
            textbutton "{size=28}The Glamorous Tomboy" align (0.5, 0) action [SetVariable("current_quest_text", "mitsuha")] text_style "quest_text"
        if mia_quest in a.journal and mia_quest.completed == False:
            textbutton "{size=28}The Exhausted Teacher" align (0.5, 0) action [SetVariable("current_quest_text", "mia")] text_style "quest_text"
        if maid_quest in a.journal and maid_quest.completed == False:
            textbutton "{size=28}The Mysterious Maid" align (0.5, 0) action [SetVariable("current_quest_text", "maid")] text_style "quest_text"
        if marca_quest in a.journal and marca_quest.completed == False:
            textbutton "{size=28}The Stressed Mother" align (0.5, 0) action [SetVariable("current_quest_text", "marca")] text_style "quest_text"
        if zenaida_quest in a.journal and zenaida_quest.completed == False:
            textbutton "{size=28}The Fitness Fanatic" align (0.5, 0) action [SetVariable("current_quest_text", "zena")] text_style "quest_text"
        if sarah_quest in a.journal and sarah_quest.completed == False:
            textbutton "{size=28}The Smiling Barista" align (0.5, 0) action [SetVariable("current_quest_text", "sarah")] text_style "quest_text"
        if mary_quest in a.journal and mary_quest.completed == False:
            textbutton "{size=28}The Joyous Shopkeeper" align (0.5, 0) action [SetVariable("current_quest_text", "mary")] text_style "quest_text"
        if bike_quest in a.journal and bike_quest.completed == False:
            textbutton "{size=28}The Bike" align (0.5, 0) action [SetVariable("current_quest_text", "bike")] text_style "quest_text"
        if lover_quest in a.journal and lover_quest.completed == False:
            textbutton "{size=28}The Club" align (0.5, 0) action [SetVariable("current_quest_text", "lover")] text_style "quest_text"
Note this part:

Code: Select all

 vbox:
        xpos 35
        ypos 308
        if urge_quest in a.journal and urge_quest.completed == False:
When I call this screen while there are more than one "quests" in a.journal, it looks fine and centers itself properly:
Captura de pantalla 2024-04-25 013927.png
(27.44 KiB) Not downloaded yet
Buuuut if I call it while there are is only one:
Captura de pantalla 2024-04-25 013902.png
(23.18 KiB) Not downloaded yet
It does this. I can't seem to find why it does that and how to fix it. My only theory is that the game is trying to place the vbox at xpos 35, which makes the shorter texts center themselves relative to the longer texts. So if a quest with short text is alone in the list, it goes to the far left of the box.

I would love some help and ideas on how to fix this.

Re: Vbox in screen seems to... move around?

Posted: Thu Apr 25, 2024 1:04 am
by philat
If box size is not specified, a box is only as large as it needs to be - i.e., the size of the largest child. While there are many ways to approach organizing your screen, the path of least change for now is probably to specify the xsize of your vbox.

Re: Vbox in screen seems to... move around?

Posted: Thu Apr 25, 2024 8:52 pm
by Yone28
philat wrote: Thu Apr 25, 2024 1:04 am If box size is not specified, a box is only as large as it needs to be - i.e., the size of the largest child. While there are many ways to approach organizing your screen, the path of least change for now is probably to specify the xsize of your vbox.
I see, I did not know that applied to vboxes. I thought it was a unique to grids.

I'll do that, then. Cheers.