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


If you want to stick with GridLayout, this will work:

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

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

                  gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
                gridData.horizontalSpan = 2;
                butt3.setLayoutData(gridData);

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

buttons 1,2 & 3 will have a fixed vertical size.
button 4 will expand vertically to fill available space.
buttons 1 and 4 will have a fixed horizontal size of 40 pixels
buttons 2 & 3 will each span two columns and expand (equally) horizontally to fill available space.

Chris.




"Veronika Irvine" <Veronika_Irvine@xxxxxxx>
Sent by: platform-swt-dev-admin@xxxxxxxxxxx

12/05/2002 01:55 PM
Please respond to platform-swt-dev

       
        To:        platform-swt-dev@xxxxxxxxxxx
        cc:        platform-swt-dev@xxxxxxxxxxx
        Subject:        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




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