Community
Participate
Working Groups
ScrolledComposite needs a way to indicate that its child's preferredSize (as returned from child.computeSize) should be used as its minimum size. The Forms library is working around this by calling setMinimumSize on every resize or layout event, but this creates extra flicker.
Note that this enhancement will mean more calls to child.computeSize, which will require adding a layout cache to ScrolledComposite (using the same pattern used by GridLayout). Otherwise, the extra calls will degrade performance.
This is still a major source of inconvenience.
Ping
Duong, please investigate.
Released code to allow SWT.DEFAULT for ScrolledComposite.setMinSize. Fixed > 081007
Thank you for looking into this. However, in the last code I tried, ScrolledComposite.setMinSize(someConstant, SWT.DEFAULT) was not working as expected for wrapping controls if someConstant was smaller than the default preferred width of the control. I was using expand(true) in both dimensions. Reopening. Observed: 1. The control expands in both dimensions. 2. When the horizontal size becomes smaller than someConstant, horizontal scrollbars appear and the control is not completely visible. Vertical scroll bars appear when the vertical size becomes too small to see the entire control. 3. When the horizontal size is larger than someConstant, vertical scroll bars start appearing too soon. Once the wrapping control starts to stretch horizontally, it consumes less vertical space. However the scroll bars start appearing at the same point as though the control were currently occupying its minimum size. This means that you see vertical scrollbars even though the control is fully visible. The scroll bars scroll over empty space. Expected: 1 & 2, but not 3. You should not see any scroll bars if the control is fully visible. I realize you could argue that 3 is a consistent behavior since the point where the vertical scrollbars appear is predictable, well-defined, and controlled by the arguments to setMinSize. However, I don't believe anyone would want to create SC instances with scrollbars that scroll over empty space, whereas almost everyone will want scrollbars when their widget can't be seen. We MUST fix this before this behavior finds its way into a release and changing it would arguably be an API change.
Note: this is the exact same bug that was in GridLayout in Eclipse 2.1 and earlier, when you supplied (someConstant, SWT.DEFAULT) as size hints for wrapping widgets.
Created attachment 115317 [details] patch for partial fix Although I would like to work with you to fix this problem. Unfortunately, I don't have time to look into this any more. I'm rolling back my fix for now and include a patch in this defect. I don't want to release a partial fix that will be considered API. Until there's a complete fix, I will not release it.
Stefan, is this something you still want added?
I am willing to review patches if there is interest in this work.
I don't work on Eclipse anymore, but something like this would allow us to approximately double the performance of most of the form-based layouts (or other complex layouts containing wrapping and scroll bars).