Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Spacing in RowLayout problem

Hi,
the RowLayout class always add one more extra spacing size. 
Here is the demostration:
Assumes that, I create 2 buttons in horizontal box:

...
    Composite comp = new Composite(parent, SWT.NONE);
    RowLayout layout = new RowLayout();
    layout.marginTop = 0;
    layout.marginBottom = 0;
    layout.marginLeft = 0;
    layout.marginRight = 0;
    layout.wrap = false;
    layout.type = SWT.HORIZONTAL;
    comp.setLayout(layout);
// In that case the default spacing is 3
    Button button1 = new Button(comp, SWT.PUSH);
    button1.setText("Button 1");
    Button button2 = new Button(comp, SWT.PUSH);
    button2.setText("Button 2");
// Assume the width of button1 = 30, button2 = 32, so the width
// of Composite comp should be = 30 + 3 + 32 = 65
// But the actual width (using getSize()) is 68 meaning: 30 + 3 + 32 + 3

Any idea to get rid of that extra spacing ?




Back to the top