Bug 206173 - Permit SWT.DEFAULT as an argument to ScrolledComposite.setMinSize
Summary: Permit SWT.DEFAULT as an argument to ScrolledComposite.setMinSize
Status: REOPENED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.3   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks: 206169
  Show dependency tree
 
Reported: 2007-10-12 13:37 EDT by Stefan Xenos CLA
Modified: 2019-02-05 01:41 EST (History)
4 users (show)

See Also:


Attachments
patch for partial fix (11.16 KB, patch)
2008-10-16 17:50 EDT, Duong Nguyen CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Xenos CLA 2007-10-12 13:37:42 EDT
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.
Comment 1 Stefan Xenos CLA 2007-10-12 13:41:08 EDT
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.
Comment 2 Stefan Xenos CLA 2008-04-10 11:27:32 EDT
This is still a major source of inconvenience.
Comment 3 Stefan Xenos CLA 2008-08-25 13:15:21 EDT
Ping
Comment 4 Steve Northover CLA 2008-08-25 13:21:34 EDT
Duong, please investigate.
Comment 5 Duong Nguyen CLA 2008-10-07 18:03:10 EDT
Released code to allow SWT.DEFAULT for ScrolledComposite.setMinSize.
Fixed > 081007
Comment 6 Stefan Xenos CLA 2008-10-14 10:54:17 EDT
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.
Comment 7 Stefan Xenos CLA 2008-10-14 10:56:13 EDT
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.
Comment 8 Duong Nguyen CLA 2008-10-16 17:50:46 EDT
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.
Comment 9 Eric Williams CLA 2016-09-15 10:43:13 EDT
Stefan, is this something you still want added?
Comment 10 Eric Williams CLA 2019-01-18 11:44:53 EST
I am willing to review patches if there is interest in this work.
Comment 11 Stefan Xenos CLA 2019-02-05 01:41:36 EST
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).