Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 83193

Summary: [Wizards] WizardPage; TableLayout with ColumnWeightData problem
Product: [Eclipse Project] Platform Reporter: Sebastian Davids <sdavids>
Component: UIAssignee: Karice McIntyre <Karice_McIntyre>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P4    
Version: 3.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 98   
Whiteboard:
Bug Depends on: 96440    
Bug Blocks:    

Description Sebastian Davids CLA 2005-01-19 10:18:24 EST
If one uses a table within a wizard page and the table uses a TableLayout and
the columns are defined via ColumWeightData, then the wizard page will be
resized to some arbitrary size.

@@

Display display = new Display();
Shell shell = new Shell(display);
WizardDialog dialog = new WizardDialog(shell, new Wizard() {
    public void addPages() {
        addPage(new WizardPage("") {
            public void createControl(Composite parent) {
                Table table = new Table(parent, SWT.H_SCROLL
                        | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER);
                table.setHeaderVisible(true);
                table.setLinesVisible(true);
                TableLayout layout = new TableLayout();
                table.setLayout(layout);
                for (int i = 0, n = 2; i < n; ++i) {
                    TableColumn column = new TableColumn(table,
                            SWT.NULL, i);
                    column.setText(String.valueOf(i));
                    layout.addColumnData(new ColumnWeightData(1));
                }
                setControl(table);
            }
        });
    }
    public boolean performFinish() {
        System.out.println(getShell().getSize());
        return true;
    }
});
dialog.open();
while (!shell.isDisposed()) {
    if (!display.readAndDispatch()) display.sleep();
}
display.dispose();

@@

This will print: Point {784, 400}

@@

Now if I use ColumnPixelData instead:

Display display = new Display();
Shell shell = new Shell(display);
WizardDialog dialog = new WizardDialog(shell, new Wizard() {
    public void addPages() {
        addPage(new WizardPage("") {
            public void createControl(Composite parent) {
                Table table = new Table(parent, SWT.H_SCROLL
                        | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER);
                table.setHeaderVisible(true);
                table.setLinesVisible(true);
                TableLayout layout = new TableLayout();
                table.setLayout(layout);
                for (int i = 0, n = 2; i < n; ++i) {
                    TableColumn column = new TableColumn(table,
                            SWT.NULL, i);
                    column.setText(String.valueOf(i));
                    layout.addColumnData(new ColumnPixelData(10));
                }
                setControl(table);
            }
        });
    }
    public boolean performFinish() {
        System.out.println(getShell().getSize());
        return true;
    }
});
dialog.open();
while (!shell.isDisposed()) {
    if (!display.readAndDispatch()) display.sleep();
}
display.dispose();

@@

This will print: Point {438, 400}

The same as if I had just embedded a label.

@@

Display display = new Display();
Shell shell = new Shell(display);
WizardDialog dialog = new WizardDialog(shell, new Wizard() {
    public void addPages() {
        addPage(new WizardPage("") {
            public void createControl(Composite parent) {
                setControl(new Label(parent, SWT.NONE));
            }
        });
    }
    public boolean performFinish() {
        System.out.println(getShell().getSize());
        return true;
    }
});
dialog.open();
while (!shell.isDisposed()) {
    if (!display.readAndDispatch()) display.sleep();
}
display.dispose();

@@

This will print: Point {438, 400}

@@@@

Using ColumnWeightData should not resize the container (wizard page).
Comment 1 Karice McIntyre CLA 2006-07-07 14:15:20 EDT
Using 3.2 (M20060629-1905) this no longer appears to be a problem. The size for each is the same {438, 367}.