How do I manipulate a ScrollContainer within an HboxContainer

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DigitalDrako

I’m making an inventory system and I have a scroll container within an hbox container. The problem is caused by the scroll bar, which is directly next to the buttons. I want to create a margin so the scroll bar doesn’t touch the buttons, but every time I resize the rect the HboxContainer prevents the resize. I have no clue why it does this as making the container 2 pixels wider doesn’t affect the horizontal sorting at all. Any clue on how to circumvent this issue?

Scroll Container in engine:


Scroll container in game:

:bust_in_silhouette: Reply From: Saitodepaula

I think you are actually using a VBoxContainer right, since your buttons are stacked vertically.

One way to solve your issue is to place the Vbox or Hbox container inside a MarginContainer, and set the CustomConstants to the margins you want. Your tree would look something like this:

ScrollContainer
    MarginContainer
        VBoxContainer
            Button1
            Button2
            .
            .
            .