I have a composite (innerComposite) in ScrolledComposite (sc). At run time, additional user interface components can be added. Therefore, I use the code below to set the minimum sc size to enable scrolling, in case additional components of the user interface overflow sc.
sc.setMinSize( innerComposite.computeSize( innerComposite.getSize().x, SWT.DEFAULT ) );
One problem is the SWT Multi-Line text box inside this sc / innerComposite.
textBox = new org.eclipse.swt.widgets.Text(parent, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);
When I enter long text in this multi-line text box, a vertical scroll bar will appear (this is what I wanted!). However, when I call the code above to recalculate the size and set sc.setMinSize () ... the height of the multi-line text box will expand to fit the length of the entered text. This is not what I wanted. I want this height to stay on the scroll bar and not change according to the text entered.
I know that computeSize will discard children to resize the preferred size . I do not want this to happen with a multi-line text field, since it has the ability to scroll through the vertical panel.
How can I prevent this?
source share