Box sizing, gtk4

Hello, everyone.
I am trying to understand how box sizing works.
The Window set to default size 640x480. Window has a single child - Box with vertical orientation. There is a FlowBox inside vertical Box.
When app starts there are no children in FlowBox, so Its height is zero and wrapping Box and Window are 640x480.
Then some widgets are added dynamically to the FlowBox. Untill it expands to the second row, surrounding Box and Window size are 640x480, but then second row of FlowBox appears Window and Box height jumps about the height of FlowBox row. Though, there are a lot of space in them to accomodate that row and even some more rows.
Why so? Is it possible to controll that behaviour?
There are no any size settings in those widgets, except the default size of window.

Sounds like a bug to me. Could you share a minimal reproducible example?

Sure. Here is minimal example in rust (should be same in other languages) + screencast demonstrating how it behaves

1 Like

Hi, that’s GtkFlowBox: the orthogonal orientation always requests the most size it could possibly need (#897) · Issues · GNOME / gtk · GitLab. As explained there, to get the desired behavior you should wrap the GtkFlowBox in a GtkScrolledWindow. Let me know if anything’s missing!

1 Like

Hey. It worked, thank you!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.