Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [platform-swt-dev] ordering problem adding buttons to a GridLayout


Try this code:

import java.lang.reflect.Constructor;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class Main {
       
public static void main(String[] args) throws Exception {
        Display display = new Display();
        Shell shell = new Shell();
        shell.setLayout(new RowLayout());
       
        Class clazz = Class.forName("org.eclipse.swt.widgets.Button");
        Constructor c = clazz.getConstructors()[0];
        c.newInstance(new Object[] {shell, new Integer(0)});
       
        shell.setSize(400,300);
        shell.open();
       
        while (!shell.isDisposed())
                if (!display.readAndDispatch())
                        display.sleep();

}

}



"Brad O'Hearne" <brado@xxxxxxxxxxxxx>
Sent by: platform-swt-dev-admin@xxxxxxxxxxx

10/22/2003 01:30 PM
Please respond to platform-swt-dev

       
        To:        <platform-swt-dev@xxxxxxxxxxx>
        cc:        
        Subject:        RE: [platform-swt-dev] ordering problem adding buttons to a GridLayout



Steve,

Thanks for the response.  I have a couple of comments below:

> 1) Fixed > 20031022

Based on your next two points, I'm a bit confused -- what was fixed?

> 2) From the SWT Home Page, "SWT component is designed to provide
> efficient, portable, access to the user-interface facilitites of
> the operating system", not facilitate GUI builders.

I'm not going to debate this one with you, but this statement doesn't
preclude or forbid thoughtful design decisions to facilitate easier use of
the API.  I have a hard time believing the SWT effort was launched with a
staunch "developer programming only" intent and aimed to be deaf to the
concerns of API usage.  Perhaps it is a style choice, perhaps it is
something more significant, but that will remain a matter of opinion I
suppose.  I read the last thread many months ago on this, and if history
serves, I don't see another debate as ending in something productive.  I'll
just leave it with this piece of advice: any API that intends to be as
user-friendly as possible and desires to see extensive automation built on
top of it needs to provide classes with parameterless (default)
constructors....period.  Otherwise, dynamically creating instances via
ClassLoaders cannot be done.

> 3) Layout is not automatic when a child is added or deleted or hidden etc.
This was done for efficiency.

I don't quite follow the rationale here.  I'm not sure what purpose there is
in efficiency when expected behavior is broken.  The Javadoc states:

"Widgets are laid out in columns from left to right,"

but the behavior isn't consistent -- left to right in one case and right to
left in another.  I can't think of a use-case where a user would want their
layout to completely violate expected behavior because a child is added or
deleted.

Steve, please forgive me if this sounds a bit curt.  It is not my intention.
I am sure you are a terrific guy, with all good intents, but after reading
the list thread touching on the issue many months ago, and receiving
essentially the same RTFM response here, I am a bit disappointed.  I guess I
hoped that an honest technical suggestion would be met with an honest
technical answer on its merits/weaknesses provided the suggestion was in
scope....and I have a hard time understanding how the usage of the SWT API
is out of the bounds of the scope of the SWT project.

Anyway, I'll figure out a way around this.

Cheers,

BradO

_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev


Back to the top