GridView

Being back to juce after more than two years. Several thing improved and may let us use it in the future👍 One first question, is there a possibility for a GridView Component? Furthermore, may I use touch-drag gestures to scroll though this component?

Thank you in advance

1 Like

This would be a great thing :wink:

You mean like the TableListBox?

My grid needs were like a view of album covers, where there’s a dynamic number of columns containing identical auto-wrapping items. I could probably put a wrapper around TableListBox to make it work…

You might be better off just using some ordinary components with a FlexBox layout - that kind of flow/wrapping stuff is what it’s great at.

1 Like

that means, I will have to implement the gridview on my own. Speaking in iOS I have to implement the gestures, the rubber band effect and the tiling on my own. That means the time we save on the audio part with juce will be lost in the UI part :confused: Hhm, tough decision.

You can use the viewport component for the scrolling and a flexbox inside it for the layout.

That’s probably true no matter what library you’re using… In my experience, it’s very unlikely that the exact grid behaviour you need would be what any kind of ready-made library “gridview” component does. You’re almost certainly going to need to customise and tweak it. A Viewport that contains some components with a FlexBox layout does exactly the same thing and IMHO is better in terms of flexibility and probably code size as well.

If you mean the multi-selection stuff by rubber band there are some handy helper classes…

How would you resize the container for all the components managed by the FlexBox? For example you load 3 items and they take a single row. How do you get the height you need to set to the container for that row? Than you load 20 more items and they should go beyond the viewport edge into scroll. Same question, here.

How do you place a FlexBox inside a ViewPort? I’m trying to find the most acceptable way to do this.