When is the time we should use has vbox and 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
tofuuu
Regular
Posts: 51
Joined: Tue Apr 24, 2018 7:15 pm
Contact:

When is the time we should use has vbox and vbox?

#1 Post by tofuuu »

Firstly first, what is the difference between hasvbox and vbox? And when we should use it? Thank you!

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: When is the time we should use has vbox and vbox?

#2 Post by Remix »

From my experience, mostly when you either do not need non default style or when you have them defined as a _v/hbox sub style of the parent...

Code: Select all

frame:
    style_prefix "my_frame"
    has vbox # uses my_frame_vbox styles (I think)

    # items

frame:
    vbox:
        spacing 17 # inline styling (easiest way to start, before moving styles away)

        # items

frame:
    has vbox # uses some default styles that might not fit
    
    # items
    
# to end the vbox, we have to un-indent past the frame
Personally I mostly prefer using vbox: so the block/items are indented and easier to see.

Also note: has vbox does not use a block so there is no easy way to "end" the content (for example if you wanted 2 vbox inside a hbox you would need to use blocks or contain each vbox in a fixed/frame or somesuch and un-indent past that container)
Frameworks & Scriptlets:

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: When is the time we should use has vbox and vbox?

#3 Post by xavimat »

I don't know the use with styles.
has vbox or has hbox are used inside other containers (mostly frame). When you need only one box on that container (you can add more boxes and other children _inside_ that box, but nothing more outside the box (in that container).
Is useful to avoid one level of indentation, specially in complex screens.
Is used a lot to give a background to a box. Boxes have no background property, so putting has vbox inside a frame produces a simple way to have a background without more indentation.
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: When is the time we should use has vbox and vbox?

#4 Post by trooper6 »

According to the documentation, you use has with elements that take only one child, like frame.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: When is the time we should use has vbox and vbox?

#5 Post by xavimat »

trooper6 wrote: Sun Aug 05, 2018 2:44 am According to the documentation, you use has with elements that take only one child, like frame.
That can be confusing. You can add many children to a frame. They will be internally wrapped inside a "fixed" so, technically that frame will have only one child (the fixed that contains the children). But, looking at the code you won't _see_ the fixed. So it _seems_ that the frame itself has more than one children. Using "has" you cannot add more children outside the "has".
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Post Reply

Who is online

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