[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Alignment Problems with ExpandBar within SashBar

Whenever I put anything in an ExpandBar within a SashBar, the alignment is weird whenever it is expanded. As you can see from the demo I attached, the StyledText box's left border is too far left (for what I need, anyway). I haven't found any way to move it right a few pixels so that it's actually *within* the SashForm box. I want it to look similar to the right side.

Is this possible?

P.S. This is my first post on the mailing list, so hi! I'm new to SWT, and love it so far. But I'm still a newbie, so bear with me. :)
import org.eclipse.swt.*;
import org.eclipse.swt.custom.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;

public class UITest {
	public UITest() {
		Display display = new Display();
		Shell shell = new Shell();
		shell.setLayout(new GridLayout(1, false));
		GridData fillBoth = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
		fillBoth.grabExcessHorizontalSpace = true;
		fillBoth.grabExcessVerticalSpace = true;
		SashForm panes = new SashForm(shell, SWT.HORIZONTAL);
		panes.setLayout(new GridLayout(1, false));
		Composite pane = new Composite(panes, SWT.NONE);
		pane.setLayout(new GridLayout(1, false));
		ExpandBar bar = new ExpandBar (pane, SWT.V_SCROLL);
		final StyledText txt1 = new StyledText(bar, SWT.V_SCROLL | SWT.MULTI);
		GridLayout layout = new GridLayout();
		final ExpandItem item = new ExpandItem(bar, SWT.NONE, 0);
		item.setHeight(txt1.computeSize(SWT.DEFAULT, SWT.DEFAULT).y*15);
		while (!shell.isDisposed())
			if (!display.readAndDispatch())
	public static void main(String[] args) {
		UITest main = new UITest();