I had a long fight getting into the guts of SWT, and I'm, not really half done with it (angry face here).
I have Group with RowLayout, that wraps. The group is within other Composites, and might get too large for the display, so I wrapped it by a ScrolledComposite.
This is where the trouble starts.
Whatever is within a ScrolledComposite gets its way in way of width and height, whatever the dimensions might be. It has some logic, as the SrolledComposite can take care of that with ScrollBars.
The thing is (or at least looks to me like), that if a RowLayout can have its way with width, it will never, ever, wrap, and this is not what it should do inside a parent that is itself restricted.
What is the intended solution to this problem?
The layout of the control that is set as the content of the scrolled composite (i.e. the argument of
sc.setContent) doesn't matter. A layout affects only the immediate children of the control that was set to.Most likely, your group widget doesn't adapt to the size of the containing scrolled composite. Note: it often helps to color relevant widgets differently (with
setBackground) to see which space they actually take.The following snippet creates a
ScrolledCompositethat scrolls vertically, if thecontentcontrol is larger than the client area of the scrolled composite.The code uses the 'browser mode' as described in the JavaDoc
Setting the
minSizein a resize-listener ensures that the minimum size adapts to the size of the scrolled composite.