GridLayout has forced margin but FillLayout does not? [message #523062] |
Wed, 24 March 2010 22:30 |
Richard Kennard Messages: 4 Registered: March 2010 |
Junior Member |
|
|
Hi guys,
I'm trying to layout some nested Composites on a Windows platform. It's hard to get the alignment right because it appears GridLayout has some kind of 'implicit margin'. FillLayout has no such margin.
For example, the code...
public static void main( String[] args )
{
Display display = new Display();
Shell shell = new Shell( display, SWT.DIALOG_TRIM | SWT.RESIZE );
shell.setLayout( new FillLayout() );
Composite composite1 = new Composite( shell, SWT.BORDER );
composite1.setLayout( new FillLayout() );
Composite composite2 = new Composite( composite1, SWT.BORDER );
composite2.setLayout( new GridLayout( 1, false ) );
Composite composite3 = new Composite( composite2, SWT.BORDER );
composite3.setLayout( new FillLayout() );
Composite composite4 = new Composite( composite3, SWT.BORDER );
shell.setVisible( true );
shell.open();
while ( !shell.isDisposed() )
{
if ( !display.readAndDispatch() )
display.sleep();
}
display.dispose();
}
...produces...
You can see that the FillLayouts are nested very close to each other, while the GridLayout has a gap of about 5 pixels at its left/top.
Is there any way to remove this implicit margin? I have tried setting marginLeft and/or horizontalSpacing to 0, but that seems to have no effect.
Thanks,
Richard.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03504 seconds