How to create scroll pane/view/bar for list?

Defold is a great engine and while i am learning lua and i have not started my project, i noticed, that in Defold actually have no scrolling realization. There is scrolling camera in examples(many thanks to @britzl) but is not scrolling list.
So, how i can create, for example, list of weapons, that i can scroll up\down without using a camera? If you don’t understand my bad english, just look at scrollpane in libgdx. Is it real to create something similar in defold? It will be very useful!
Thanks for attention!

You can make this from scratch. Track input. Offset y of list group based on scroll value. Position list elements relative to each other. I don’t think https://github.com/andsve/dirtylarry has scrollers yet but it’s something that could be added. I have some examples I still need to publish too for widget/panel/scroller. But you should try too to make something from scratch to learn!

As @Pkeod said, there is nothing that can do this out of the box, but it’s fairly simple to build. You can do this either in gui or go space.

In gui:

  1. Create a root node
  2. Create child nodes to hold your list of weapons. Either at runtime using gui.clone(), gui.clone_tree() or gui.new_box_node(), [gui.play_flipbook()] (http://www.defold.com/ref/gui/#gui.play_flipbook:node-animation--complete_function-) and gui.set_parent() or pre-create them in your gui scene
  3. Animate/move the root node based on user input and the child nodes will follow along
  4. Bonus: Use gui clipping if you wish to limit the area in which the nodes should be rendered while scrolling

In go:

  1. Create a root game object
  2. Create child game objects to hold your list of weapons. Either at runtime using factory.create() and set_parent or pre-create them in your collection
  3. Animate/move the root game object based on user input and the child game objects will follow along
8 Likes

Thanks a lot for your answers @britzl @Pkeod
I will definitely try these methods :slight_smile:

1 Like