Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsLayout problem in 3.1?
https://www.eclipse.org/forums/index.php/mv/msg/142580/448999/#msg_448999
I wondered if somebody noticed the following behaviour: The program below
first sets the size of the shell, then adds a GridLayout and a number of
children. The behaviour is that only the sheel is drawn.
However, when moving the shell.setSize after the addition of the children,
everything seems Ok!
This seems a bit odd to me. Is there an explanation? I am using eclipse
3.1M4. In Eclipse 3.0.1 it works fine though. This is a very silly problem.
public class DemoFullTimelineControl {
public static void main(String args[]) {
try {
Display display = Display.getDefault();
Shell shell = new Shell(display, SWT.SHELL_TRIM);
shell.setText("SWT Application");
shell.setSize(410, 503); // Children are not drawn!
final GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
shell.setLayout(gridLayout);
final Label label = new Label(shell, SWT.NONE);
label.setText("label");
final Scale scale = new Scale(shell, SWT.NONE);
// shell.setSize(410, 503); // Only now the children are drawn too
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
Kind regards,
Jaap]]>Jaap Reitsma2005-01-17T15:56:54-00:00Re: Layout problem in 3.1?
https://www.eclipse.org/forums/index.php/mv/msg/142580/449004/#msg_449004
Composite.layout(boolean).
You have two options in the example below, either call shell.setSize(410,
503) after configuring the layout (e.g. just before shell.open()) OR call
shell.layout(false) after configuring the layout (e.g. just before
shell.open()) .
In eclipse 3.0.1, shell.open() gave a free resize event on some platforms
(Windows). In eclipse 3.1 we have made the resize behaviour consistent
across all platforms. Therefore, in 3.1 you will only get a resize event on
shell.open() if you have never set the size or bounds of the shell.
"Jaap Reitsma" <Jaap.Reitsma@telin.nl> wrote in message
news:csgn86$pbq$1@www.eclipse.org...
> Hi all,
>
> I wondered if somebody noticed the following behaviour: The program below
> first sets the size of the shell, then adds a GridLayout and a number of
> children. The behaviour is that only the sheel is drawn.
>
> However, when moving the shell.setSize after the addition of the children,
> everything seems Ok!
>
> This seems a bit odd to me. Is there an explanation? I am using eclipse
> 3.1M4. In Eclipse 3.0.1 it works fine though. This is a very silly
> problem.
>
> public class DemoFullTimelineControl {
> public static void main(String args[]) {
> try {
> Display display = Display.getDefault();
> Shell shell = new Shell(display, SWT.SHELL_TRIM);
> shell.setText("SWT Application");
> shell.setSize(410, 503); // Children are not drawn!
>
> final GridLayout gridLayout = new GridLayout();
> gridLayout.numColumns = 2;
> shell.setLayout(gridLayout);
>
> final Label label = new Label(shell, SWT.NONE);
> label.setText("label");
>
> final Scale scale = new Scale(shell, SWT.NONE);
> // shell.setSize(410, 503); // Only now the children are drawn too
>
> shell.open();
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch())
> display.sleep();
> }
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
>
> }
>
>
> Kind regards,
>
> Jaap
>
>
>]]>Veronika Irvine2005-01-17T16:52:51-00:00