I think I'm having problems with the size stuff but I'm not sure.
Basically I've forced the scroll bar to show, but it's not enabled.
Here's my code as a subclass of org.eclipse.jface.window.Window:
protected Control createContents(Composite parent) {
//layout the parent composite
GridLayout layout = new GridLayout();
layout.marginWidth = 0;
layout.marginHeight = 2;
parent.setLayout(layout);
ScrolledComposite scrolledComposite = new
ScrolledComposite(parent,
SWT.V_SCROLL | SWT.BORDER);
scrolledComposite.setAlwaysShowScrollBars(true);
//layout the composite holding the content
content = new Composite(scrolledComposite, SWT.BORDER);
scrolledComposite.setContent(content);
content.setLayout(new GridLayout(2, false));
content.setLayoutData(new GridData(GridData.FILL_BOTH));
//heading font
FontData fontData = new FontData();
fontData.setStyle(SWT.BOLD);
Font font = new Font(Display.getCurrent(), fontData);
//create the heading labels
Label label = new Label(content, SWT.CENTER);
label.setText("Variable Name");
label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
label.setFont(font);
label = new Label(content, SWT.NULL);
label.setText("Hide Variable?");
label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
label.setFont(font);
//adds 0-many labels to content
addVariablePairs();
content.setSize(content.computeSize(SWT.DEFAULT,
SWT.DEFAULT));
content.layout(true);
return parent;
}
Thanks
Lionel.
Set the layout of the parent to FillLayout and it works.
thanks
Lionel.