Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [platform-swt-dev] GridLayout (w/Table) and vertical alignment problems


Udaya,

Actually, Grant Gayed gave me the suggestion in a reply to add the following to my button composite:

        Composite buttons = new Composite(composite, SWT.NONE);
               --> buttons.setLayoutData( new GridData(GridData.VERTICAL_ALIGN_BEGINNING));


Now my buttons align at the top.  Thanks for the suggestion on the different layouts.  I will check them out.



"Udaya Tejwani" <udayatejwani@xxxxxxxxxxx>
Sent by: platform-swt-dev-admin@xxxxxxxxxxx

02/24/2004 09:41 AM
Please respond to platform-swt-dev

       
        To:        platform-swt-dev@xxxxxxxxxxx
        cc:        
        Subject:        RE: [platform-swt-dev] GridLayout (w/Table) and vertical alignment problems



You have two options -

1. Use FormLayout

2. Design Custom Layout.

I believe Form Layout would be easier.

Hope this helps.

Udaya K. Tejwani

>From: rjohnson2@xxxxxxxxxxxxxxx
>Reply-To: platform-swt-dev@xxxxxxxxxxx
>To: platform-swt-dev@xxxxxxxxxxx
>Subject: [platform-swt-dev] GridLayout (w/Table) and vertical alignment problems
>Date: Mon, 23 Feb 2004 15:23:32 -0600
>MIME-Version: 1.0
>Received: from mc10-f26.hotmail.com ([65.54.166.162]) by mc10-s4.hotmail.com with Microsoft SMTPSVC(5.0.2195.6824); Mon, 23 Feb 2004 13:29:10 -0800
>Received: from dev.eclipse.org ([204.138.98.15]) by mc10-f26.hotmail.com with Microsoft SMTPSVC(5.0.2195.6824); Mon, 23 Feb 2004 13:28:44 -0800
>Received: from dev.eclipse.org (localhost.localdomain [127.0.0.1])by dev.eclipse.org (Postfix) with ESMTPid DE84A23FF8; Mon, 23 Feb 2004 16:25:06 -0500 (EST)
>Received: from www.oreillyauto.com (unknown [12.14.247.133])by dev.eclipse.org (Postfix) with ESMTP id D7E5623FF8for ; Mon, 23 Feb 2004 16:23:14 -0500 (EST)
>X-Message-Info: +va6sINXO+9wjWV6+Mh1QQJ5KAsN2DTiZIW3PkzVOCY=
>Delivered-To: platform-swt-dev@xxxxxxxxxxx
>X-Mailer: Lotus Notes Release 5.0.10  March 22, 2002
>Message-ID:
>X-MIMETrack: Serialize by Router on Domsvr/OReilly(Release 5.0.11  |July 24, 2002) at 02/23/2004 03:23:33 PM
>Errors-To: platform-swt-dev-admin@xxxxxxxxxxx
>X-BeenThere: platform-swt-dev@xxxxxxxxxxx
>X-Mailman-Version: 2.0.13
>Precedence: bulk
>List-Unsubscribe: ,
>List-Id: Eclipse Platform SWT component developers list.
>List-Post:
>List-Help:
>List-Subscribe: ,
>List-Archive:
>Return-Path: platform-swt-dev-admin@xxxxxxxxxxx
>X-OriginalArrivalTime: 23 Feb 2004 21:28:45.0113 (UTC) FILETIME=[0432A290:01C3FA54]
>
>I'm trying to create a screen using a GridLayout with two columns.  On the
>left column I want three vertical buttons and on the right column I want a
>Table.  My problem is that I cannot get the buttons to align with the top
>of the Table.  They always align with the center of the table no matter
>what I try.  Below is my code and I have attached a screenshot of the
>screen.  Thanks for the help.
>
>---------------------------------------
>public Control createContents(Composite parent)
>{
>         Composite composite = new Composite(parent, SWT.NONE);
>
>         GridLayout layout = new GridLayout();
>
>         layout.numColumns = 2;
>         composite.setLayout(layout);
>
>         Composite buttons = new Composite(composite, SWT.NONE);
>         GridLayout buttonLayout = new GridLayout();
>         buttonLayout.numColumns = 1;
>         buttons.setLayout(buttonLayout);
>
>         Button button = new Button(buttons, SWT.PUSH);
>         button.setText("Add Model");
>         GridData data = "" GridData();
>         data.widthHint = 100;
>         button.setLayoutData(data);
>
>         button = new Button(buttons, SWT.PUSH);
>         button.setText("Work with Model");
>         data = "" GridData();
>         data.widthHint = 100;
>         button.setLayoutData(data);
>
>         button = new Button(buttons, SWT.PUSH);
>         button.setText("Export to Score");
>         data = "" GridData();
>         data.widthHint = 100;
>         button.setLayoutData(data);
>
>         final TableViewer tbv = new TableViewer(composite, SWT.BORDER |
>SWT.FULL_SELECTION | SWT.MULTI);
>         tbv.setContentProvider(new TableCP());
>         tbv.setLabelProvider(new TableLP(composite.getDisplay()));
>
>         GridData gridData = new GridData();
>         gridData.horizontalAlignment = GridData.FILL;
>         gridData.grabExcessHorizontalSpace = true;
>         gridData.grabExcessVerticalSpace = true;
>         gridData.verticalAlignment = GridData.FILL;
>         tbv.getTable().setLayoutData(gridData);
>
>         TableColumn column = new TableColumn(tbv.getTable(), SWT.LEFT);
>         column.setText("ID");
>         column.setWidth(50);
>
>         column = new TableColumn(tbv.getTable(), SWT.LEFT);
>         column.setText("Description");
>         column.setWidth(300);
>
>         column = new TableColumn(tbv.getTable(), SWT.LEFT);
>         column.setText("Status");
>         column.setWidth(100);
>
>         tbv.getTable().setHeaderVisible(true);
>
>         return composite;
>}
>------------------------------------------------------------
>
>Robert Johnson
>Oreilly Automotive, Inc.
>Information Systems - Internet Team
>417-862-2674 x1878
><< screenshot.jpg >>


Store more e-mails with MSN Hotmail Extra Storage – 4 plans to choose from!
_______________________________________________ platform-swt-dev mailing list platform-swt-dev@xxxxxxxxxxx http://dev.eclipse.org/mailman/listinfo/platform-swt-dev


Back to the top