Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » FormLayout and child relative height
FormLayout and child relative height [message #508719] Tue, 19 January 2010 23:23 Go to next message
Pietro is currently offline PietroFriend
Messages: 27
Registered: July 2009
Junior Member
Hi all,
I've a parent composite with formlayout.
I'd like to create three other composite on it and I want that everyone
take up 30% of parent. Tha last 10% of parent is filled by another
composite.
How can I do this task?

I'm on Windows XP and I'm using SWT 3.448

Thanls in advance,
Pietro
Re: FormLayout and child relative height [message #509881 is a reply to message #508719] Mon, 25 January 2010 16:28 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
Hi Pietro, is this what you mean?

public static void main (String [] args) {
Display display = new Display ();
final Shell shell = new Shell (display);
shell.setBounds(10,10,200,200);
Composite composite1 = new Composite(shell, SWT.BORDER);
Composite composite2 = new Composite(shell, SWT.BORDER);
Composite composite3 = new Composite(shell, SWT.BORDER);
FormLayout formLayout = new FormLayout ();
shell.setLayout (formLayout);

FormData labelData = new FormData ();
labelData.left = new FormAttachment (0);
labelData.right = new FormAttachment (30);
labelData.top = new FormAttachment (0);
labelData.bottom = new FormAttachment (100);
composite1.setLayoutData (labelData);

labelData = new FormData ();
labelData.left = new FormAttachment (30);
labelData.right = new FormAttachment (60);
labelData.top = new FormAttachment (0);
labelData.bottom = new FormAttachment (100);
composite2.setLayoutData (labelData);

labelData = new FormData ();
labelData.left = new FormAttachment (60);
labelData.right = new FormAttachment (90);
labelData.top = new FormAttachment (0);
labelData.bottom = new FormAttachment (100);
composite3.setLayoutData (labelData);

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

Grant


"Pietro Santurelli" <santurelli@inwind.it> wrote in message
news:hj5f1r$c73$1@build.eclipse.org...
> Hi all,
> I've a parent composite with formlayout.
> I'd like to create three other composite on it and I want that everyone
> take up 30% of parent. Tha last 10% of parent is filled by another
> composite.
> How can I do this task?
>
> I'm on Windows XP and I'm using SWT 3.448
>
> Thanls in advance,
> Pietro
Previous Topic:Selection in Text and mouse events
Next Topic:OLE embedding and paste automation for Word
Goto Forum:
  


Current Time: Fri Sep 20 01:51:48 GMT 2024

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

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

Back to the top