How to make a list with a Scrolling Container?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By CowThing
:warning: Old Version Published before Godot 3 was released.

I want to make an inventory list that can be scrolled up and down. I have a ScrollContainer, and I’ve tried adding some Panel children to it, but they are always set to position (0,0). How do I properly add children to the ScrollContainer to make a list?

:bust_in_silhouette: Reply From: kakoeimon

You add a Node Scrollcontainer, then add a Child Node ( VBoxContainer for vertical or HBoxContainer for horizontal listing) to the ScrollContainer.
Set the Separation of the VBoxContainer (or HBoxContainer) to the value (in pixels) you want the objects to be Separated.
After that you can add child nodes to the V(H)BoxContainer and you are done.
NOTE1 that for the child notes to be listed those nodes must be Control nodes. For example if you want to have a scrolling list of Buttons the Child Node must look like this :
Control->Button.
The reason is, if I understand it correctly, that the V(H)BoxContainer will automatically change the position of the Control nodes to fit the Separation value.
Note2 The last child of the V(H)Boxcontainer may not be listed, for reasons unknown to me, the easy way to bypass this is to add a Control node as the last Child Node.

Thank you, this worked!

CowThing | 2016-03-28 13:25

In 2.1-dev I’m unable to reproduce note1 and note2 :)

Bojidar Marinov | 2016-03-29 08:25

Bojidar I haven’t tried the current dev version, I am using the latest 2.0.1 release. But your problem probably is that you haven’t changed the Rect size of the ScrollContainer.

kakoeimon | 2016-03-30 05:19

I created a simple example, check it out : GitHub - kakoeimon/Godot_ScrollContainer_Example: An example of a Scroll container for Godot 2.0.1

kakoeimon | 2016-03-30 05:56

I can’t find the “Separation” member for the H(V)BoxContainer in the documentation or Godotengine editor.
Can you give a link to its API?

genete | 2016-03-30 19:03

Yes, the documentation is empty : HBoxContainer — Godot Engine (latest) documentation in English
Separation is under the params tab of the selected node. Default 2.0.1 to the right. You know the tab where you can change anchor, margin, rect and etc.

kakoeimon | 2016-03-30 20:17