Touch-scrollable ItemList

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

Hi there. I’d like to have the ItemList scrollable by touch (specifically on Android), similar to using a ScrollContainer. So it would allow me to scroll by touch, and also select an item by touch, as per common on Android with lists of items.

Any ideas?

I thought of:

  1. Extending ItemList, handling touch input events, and scrolling the ItemList in response. Couple of problems: I can’t see how to scroll it programmatically, and how to remove the scroll bar.
  2. edit: removed
    edit: 3. Add items (e.g. TextureFrame, Label) to ScrollContainer, and somehow bypass input events on these items if they are DRAG events, allowing ScrollContainer to process those, and the items only process ‘press’ type events.

(Bonus points for swiping an item out of the list, although I can see this being a custom control).

:bust_in_silhouette: Reply From: xyzzyx

Obviously the best solution would be to have support for Android functions like swipe, tilt and shake by the engine.
But as a workaround … how about an invisible HSlider or VSlider in a huge or corresponding size or scale and then adding a function for signal value_changed and check at least 2 or 3 calls to find out that it goes to the same direction and how fast it is moved.
That would be the input solution as I did it. For the positioning solution maybe a viewport or camera2D is necessary?

You mean like an area on a value changed buttons and swipe on it for getting the value?

Okan Ozdemir | 2020-04-18 20:31