Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Forms Section with GridLayout and horizontalIndent
Forms Section with GridLayout and horizontalIndent [message #324731] Thu, 31 January 2008 08:35 Go to next message
Eclipse UserFriend
This is a multipart message in MIME format

--Xananews.1.2.3

Hi,

I've got a View that displays some Attributes of an Object,
like Length, Width etc. I wanted to do this with Eclipse Forms,
so I created a Section whose body is a Composite with a
GridLayout(3, false). I have the name of the Field in the 1st column,
a text-widget in 2nd, and a unit in the 3rd. (see attached screenshot).
Between the first two columnsthere should be a bigger spacing,
while between the last two there only should be a small spacing.
I use GridData.horizontalIndent with a negatiove-value on the last
column for this, but it only seems to work for up to two rows.
starting with the 3rd row, it looks like my screenshot.
It works in a non-Forms View and also in a Forms-View using
a TableWrapLayout.
Whats the problem here with GridLayout?

thanks,
Manuel


--


--Xananews.1.2.3
Content-Type: Application/Octet-Stream; name=formsGridLayout.png
Content-Transfer-Encoding: base64

iVBORw0KGgoAAAANSUhEUgAAAcYAAABzCAIAAACNcDUMAAAGYklEQVR4nO3d y64cxR0H4J4zYwdv
HCnCOI6MYcEiUrjLNlLEIsoqT+It2GDzDAlgJyz9JKwQiyhSiOXEmKAsskgI wvEFUMgCFNucLBqV
i+7q9syZ/0zP9Pm+hdVTXV1dPTr+qfoyXZPd3d0KgAg7Q3cAYDxEKkAYkQoQ ZpZ/uHvv/u8/+PvX
3/xvqN4AbJdDPzj48ktPHZhN64+TdHvq7r37V69/cvK5J6Y7hq4Ac7n/7bdX rv3zxWdO1Kn6IFLf
ff+jX/78p7MD05u3vxq0hwBb4+iRw/fu3n/vD3/71S+ervIT/9l0evDg7Oad r3Z2JsN1D2Cb3P78
v0cfPTybfnfin0fqTlVVk4k8BVhMnZ/V9yJ1tnGR+uRLb1RV9Y8//nqrdwGM Xp2fVTtSd/YaqSdO
X6iq6pMPftOz3L9Vl0aX5tlkUfkuiu2vYqfAaBQjdVpV1ZKD1HzzruXcv/70 8JAqbhs7mG63duL0
hdS3x09dWMVOgdGYz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Cc2mGy6ntT1eCvTfGYFDAmA0eqJAXGxMv9ljXuN5UBC/EI PUAYv/EHCCNSAcKI
VIAwIhUgjEgFCOMhqqV4ggr2YMTzCovUZY34jwNWYdwDESf+AGFEKkCYwSK1 /RJVr1UFtt1KJp1u
L3fFpRgFxmRNo1RvEgD2gzXd8c9nKGyvqswyDUTb7kmn0yTS7X9THbNMA+u0 /kmn3fEHCCNSAcJE
Rmp+pt8+6wcYvbX+INUs08C4BUdq10zRxamke1ZJWGBJg0w67VoqQBiRChDG y/2WNe43lQELcVMe
IIwTf4AwIhUgjEgFCCNSAcKIVIAwHqJaiieoYA9GPK+wSF3WiP84YBXGPRBx 4g8QRqQChBGpAGEi
J51O8sLlm12yBYC1ibw91Z6MzwsEgH1lJXf82zOkNuZD7ZoMtl2z6p2VujgP K0C17ZNO9+sawDYm
g23MSt0Y6hbXylOgy/onnV5TpM5/SbS/ZnutPAU2xzoitTG67K/cH5ECFNhk K3mIKuRkfNHhKsDg
IkepXRd923NNd8lrpkse6bpyey3ARgmL1GLGdc013TUZbLGdnsmoBSvQxaTT ANtNpAKE8XK/ZY37
TWXAQjwnDxDGiT9AGJEKEOb/rQQZu6g0aJYAAAAASUVORK5CYII=

--Xananews.1.2.3--
Re: Forms Section with GridLayout and horizontalIndent [message #324739 is a reply to message #324731] Thu, 31 January 2008 09:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

Manuel Steurer wrote:
> Hi,
>
> I've got a View that displays some Attributes of an Object,
> like Length, Width etc. I wanted to do this with Eclipse Forms,
> so I created a Section whose body is a Composite with a
> GridLayout(3, false). I have the name of the Field in the 1st column,
> a text-widget in 2nd, and a unit in the 3rd. (see attached screenshot).
> Between the first two columnsthere should be a bigger spacing,
> while between the last two there only should be a small spacing.
> I use GridData.horizontalIndent with a negatiove-value on the last
> column for this, but it only seems to work for up to two rows.
> starting with the 3rd row, it looks like my screenshot.
> It works in a non-Forms View and also in a Forms-View using
> a TableWrapLayout.
> Whats the problem here with GridLayout?

It's hard to diagnose the problem without any code, but if I wanted to
produce the layout you describe I would start by setting the
GridLayout's horizontal spacing to 0 and then specify a positive
horizontalIndent on the Text, which will offset it from the first label.

Here's a snippet of code as an example:
(This code was easily produced using the SWT Layout example tool from
the SWT Examples project http://www.eclipse.org/swt/examples.php)


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

public class MyLayout {
public static void main (String [] args) {
Display display = new Display ();
Shell shell = new Shell (display);
GridLayout gridLayout = new GridLayout ();
gridLayout.numColumns = 3;
gridLayout.horizontalSpacing = 0;
shell.setLayout (gridLayout);

Label label0 = new Label (shell, SWT.NONE);
label0.setText ("label0");

Text text1 = new Text (shell, SWT.BORDER);
text1.setText ("text1");
GridData data = new GridData ();
data.horizontalAlignment = GridData.FILL;
data.horizontalIndent = 25;
data.grabExcessHorizontalSpace = true;
text1.setLayoutData (data);

Label label2 = new Label (shell, SWT.NONE);
label2.setText ("label2");

shell.pack ();
shell.open ();

while (!shell.isDisposed ()) {
if (!display.readAndDispatch ())
display.sleep ();
}
display.dispose ();
}
}
Re: Forms Section with GridLayout and horizontalIndent [message #324741 is a reply to message #324739] Thu, 31 January 2008 10:00 Go to previous message
Eclipse UserFriend
Hi Eric,

thanks for your answer, problem solved.

Manuel


Eric Rizzo wrote:

> Manuel Steurer wrote:
> > Hi,
> >
> > I've got a View that displays some Attributes of an Object,
> > like Length, Width etc. I wanted to do this with Eclipse Forms,
> > so I created a Section whose body is a Composite with a
> > GridLayout(3, false). I have the name of the Field in the 1st
> > column, a text-widget in 2nd, and a unit in the 3rd. (see attached
> > screenshot). Between the first two columnsthere should be a bigger
> > spacing, while between the last two there only should be a small
> > spacing. I use GridData.horizontalIndent with a negatiove-value on
> > the last column for this, but it only seems to work for up to two
> > rows. starting with the 3rd row, it looks like my screenshot. It
> > works in a non-Forms View and also in a Forms-View using a
> > TableWrapLayout. Whats the problem here with GridLayout?
>
> It's hard to diagnose the problem without any code, but if I wanted
> to produce the layout you describe I would start by setting the
> GridLayout's horizontal spacing to 0 and then specify a positive
> horizontalIndent on the Text, which will offset it from the first
> label.
>
> Here's a snippet of code as an example:
> (This code was easily produced using the SWT Layout example tool from
> the SWT Examples project http://www.eclipse.org/swt/examples.php)
>
>
> import org.eclipse.swt.*;
> import org.eclipse.swt.custom.*;
> import org.eclipse.swt.graphics.*;
> import org.eclipse.swt.layout.*;
> import org.eclipse.swt.widgets.*;
>
> public class MyLayout {
> public static void main (String [] args) {
> Display display = new Display ();
> Shell shell = new Shell (display);
> GridLayout gridLayout = new GridLayout ();
> gridLayout.numColumns = 3;
> gridLayout.horizontalSpacing = 0;
> shell.setLayout (gridLayout);
>
> Label label0 = new Label (shell, SWT.NONE);
> label0.setText ("label0");
>
> Text text1 = new Text (shell, SWT.BORDER);
> text1.setText ("text1");
> GridData data = new GridData ();
> data.horizontalAlignment = GridData.FILL;
> data.horizontalIndent = 25;
> data.grabExcessHorizontalSpace = true;
> text1.setLayoutData (data);
>
> Label label2 = new Label (shell, SWT.NONE);
> label2.setText ("label2");
>
> shell.pack ();
> shell.open ();
>
> while (!shell.isDisposed ()) {
> if (!display.readAndDispatch ())
> display.sleep ();
> }
> display.dispose ();
> }
> }



--
Previous Topic:Migration source code
Next Topic:IWorkbenchPage.getEditorReferences vs. tab order
Goto Forum:
  


Current Time: Fri Sep 19 17:42:07 EDT 2025

Powered by FUDForum. Page generated in 0.03682 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top