Designer does not layout widgets correctly

SWT Designer allows you to create the views, editors, perspectives, pref pages, composites, etc. that comprise Eclipse SWT & RCP applications and plug-ins.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

Designer does not layout widgets correctly

Postby nph » Fri Oct 22, 2004 1:24 am

I am evaluating Windowbuilder using SWT Designer downloaded 11 of October 2004 in Eclipse 3.1.0 Build id: 200409240800. I have started to make a testproject using a scrolled composite containing a composite containing a label and a text, but I do not get it to show up correctly in the design view. When I try to add something it ends up in the upper left corner of the view.
The code
Code: Select all
/*
* Created on 2004-okt-21
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
package com.test.min;

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

/**
* @author nilpet1
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
public class ComplexWithScrollPane {

    private static Text dogName;
    public static void main(String[] args) {
        final Display display = Display.getDefault();
        final Shell shell = new Shell();
        shell.setLayout(new FillLayout());
        shell.setSize(500, 375);
        shell.setText("Dog Show entry");

        final ScrolledComposite scrolledComposite = new ScrolledComposite(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);

        final Composite c1 = new Composite(scrolledComposite, SWT.NONE);
        final GridLayout gridLayout = new GridLayout();
        gridLayout.numColumns = 3;
        c1.setLayout(gridLayout);
        scrolledComposite.setContent(c1);
       
        final Label dogNameLabel = new Label(c1, SWT.NONE);
        dogNameLabel.setText("Dog´s name:");

        dogName = new Text(c1, SWT.BORDER);
        GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
        gridData.horizontalSpan = 2;

        dogName.setLayoutData(gridData);

       
        c1.setSize(492, 348);


        shell.layout();
        shell.open();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch())
                display.sleep();
        }
    }
}
nph
 
Posts: 6
Joined: Fri Oct 22, 2004 12:54 am

Re: Designer does not layout widgets correctly

Postby Eric Clayberg » Sat Oct 23, 2004 10:54 am

nph wrote:I have started to make a testproject using a scrolled composite containing a composite containing a label and a text, but I do not get it to show up correctly in the design view. When I try to add something it ends up in the upper left corner of the view.

This was caused by a bug in Eclipse/SWT itself. We have added a work around to Designer that will make it work. This fix is now available in the latest v2.1.1 update.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to SWT Designer

Who is online

Users browsing this forum: No registered users and 1 guest