Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] [GridData] Buttons Placement Problem

This looks like a perfect candidate for Form Layout.  See the following
article under FormLayout:

http://www.eclipse.org/articles/Understanding%20Layouts/Understanding%20Layouts.htm



|---------+---------------------------------->
|         |           "charpiot yoann"       |
|         |           <yolepro@xxxxxxxxxxx>  |
|         |           Sent by:               |
|         |           platform-swt-dev-admin@|
|         |           eclipse.org            |
|         |                                  |
|         |                                  |
|         |           12/05/2002 08:52 AM    |
|         |           Please respond to      |
|         |           platform-swt-dev       |
|         |                                  |
|---------+---------------------------------->
  >-----------------------------------------------------------------------------------------------------------------|
  |                                                                                                                 |
  |        To:      platform-swt-dev@xxxxxxxxxxx                                                                    |
  |        cc:                                                                                                      |
  |        Subject: [platform-swt-dev] [GridData] Buttons Placement Problem                                         |
  >-----------------------------------------------------------------------------------------------------------------|



Hello,

i'm using SWT from eclipse API and i'm trying to do some easy GUI but
without success. A pic of what I do can be seen here :

http://yolepro.multimania.com/SWT.gif

and my code is the following :

import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.custom.*;
import org.eclipse.swt.layout.*;

public class TestSWT {

public static void main (String [] args) {
  Display display = new Display ();
  Shell shell = new Shell (display);

  GridLayout gridLayout = new GridLayout();
          gridLayout.numColumns = 3;
  shell.setLayout(gridLayout);

  Button butt1 = new Button(shell, SWT.PUSH);
  Button butt2 = new Button(shell, SWT.PUSH);
  Button butt3 = new Button(shell, SWT.PUSH);
  Button butt4 = new Button(shell, SWT.PUSH);

  GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
        gridData.widthHint = 40;
        gridData.grabExcessHorizontalSpace = false;
  butt1.setLayoutData(gridData);

  gridData = new GridData(GridData.FILL_HORIZONTAL);
        gridData.horizontalSpan = 2;
  butt2.setLayoutData(gridData);

  gridData = new GridData(GridData.FILL_HORIZONTAL);
        gridData.verticalAlignment = gridData.FILL_VERTICAL;
        gridData.horizontalSpan = 2;
  butt3.setLayoutData(gridData);

  gridData = new GridData(GridData.FILL_VERTICAL);
        gridData.widthHint = 40;
        gridData.grabExcessHorizontalSpace = true;
  butt4.setLayoutData(gridData);

  shell.pack ();
  shell.open ();
  while (!shell.isDisposed ()) {
   if (!display.readAndDispatch ()) display.sleep ();
  }
  display.dispose ();
}
}

The problem is the following :
  I want both arrowed button (shown in the picture) with fixed size and
button next to its that
take the rest of the window (when you resize it horizontaly).

Thanks in advance for your help.
Any help, even a good place to find prescious help ;)


_________________________________________________________________
MSN Search, le moteur de recherche qui pense comme vous !
http://search.msn.fr/worldwide.asp

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






Back to the top