I have a UI which looks like below.
What I'm trying to do here is I initialize the whole UI in the beginning and call the relayout()
method whenever the user has filled some input. The problem here is, if my content (the "name" here) takes more spaces, then the scroll bar is supposed to show up and let user scroll so that they can see the data, but the scroll bar doesn't show up at all.
protected void initializeFrame() {
setLayout(new FillLayout());
mainComposite = new Composite(this, SWT.NONE);
mainComposite.setBackground(getBackground());
GridLayout layout = new GridLayout(2, false);
mainComposite.setLayout(layout);
GridData data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.grabExcessHorizontalSpace = true;
data.horizontalSpan = 2;
headingComposite = new Composite(mainComposite, SWT.BORDER);
headingComposite.setBackground(getBackground());
headingComposite.setLayoutData(data);
scrolledComposite = new ScrolledComposite(mainComposite, SWT.V_SCROLL| SWT.H_SCROLL);
scrolledComposite.getVerticalBar().setIncrement(10);
scrolledComposite.getVerticalBar().setPageIncrement(100);
scrolledComposite.getHorizontalBar().setIncrement(10);
scrolledComposite.getHorizontalBar().setPageIncrement(100);
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setExpandVertical(true);
data = new GridData(GridData.FILL_BOTH );
data.widthHint = 500;
scrolledComposite.setLayoutData(data);
leftEditorComposite = new Composite(scrolledComposite, SWT.BORDER);
leftEditorComposite.setBackground(getBackground());
scrolledComposite.setContent(leftEditorComposite);
data = new GridData(GridData.FILL_BOTH);
data.widthHint = 150;
rightEditorComposite = new Composite(mainComposite, SWT.BORDER);
rightEditorComposite.setBackground(getBackground());
rightEditorComposite.setLayoutData(data);
}
public void relayout() {
scrolledComposite.setMinSize(leftEditorComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
Can anyone tell me what is wrong here?