Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » FormLayout
FormLayout [message #465564] Thu, 15 December 2005 13:25 Go to next message
Stephen is currently offline StephenFriend
Messages: 47
Registered: July 2009
Member
Hi,

I'm facing some problem.
I have three composite in a composite.

The top and bottom composite are fixed sized in height.
The middle one may vary in size.
And the parent composite is resizable.

The problem is ;
when a parent composite is resized, the bottom composite comes to the area
of top composite.
I use "top composite" for the "top" form attachment of middle composite
and don't know what to put as the "bottom" attachment of the "bottom
composite".

The idea is like a window with title bar and status bar.

--
Thanks
Re: FormLayout [message #465568 is a reply to message #465564] Thu, 15 December 2005 14:03 Go to previous messageGo to next message
Stefan Langer is currently offline Stefan LangerFriend
Messages: 236
Registered: July 2009
Senior Member
As a bottom attachement use FormAttachement(100, 0) which means 100% of
parent composite and no margin so it will always go to the bottom of the
containing composite.

Regards
Stefan

Stephen wrote:
> Hi,
>
> I'm facing some problem. I have three composite in a composite.
>
> The top and bottom composite are fixed sized in height.
> The middle one may vary in size.
> And the parent composite is resizable.
>
> The problem is ;
> when a parent composite is resized, the bottom composite comes to the
> area of top composite.
> I use "top composite" for the "top" form attachment of middle composite
> and don't know what to put as the "bottom" attachment of the "bottom
> composite".
>
> The idea is like a window with title bar and status bar.
>
> --
> Thanks
>
Re: FormLayout [message #465570 is a reply to message #465564] Thu, 15 December 2005 14:10 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
Is this what you mean:

public static void main (String [] args) {
Display display = new Display ();
Shell shell = new Shell (display);
shell.setLayout(new FormLayout());
Composite top = new Composite(shell, SWT.BORDER);
Composite middle = new Composite(shell, SWT.BORDER);
Composite bottom = new Composite(shell, SWT.BORDER);
FormData data = new FormData();
data.left = new FormAttachment(0, 5);
data.right = new FormAttachment(100, -5);
data.top = new FormAttachment(0, 5);
data.height = 200;
top.setLayoutData(data);
data = new FormData();
data.left = new FormAttachment(0, 5);
data.right = new FormAttachment(100, -5);
data.top = new FormAttachment(top, 5);
data.bottom = new FormAttachment(bottom, -5);
middle.setLayoutData(data);
data = new FormData();
data.left = new FormAttachment(0, 5);
data.right = new FormAttachment(100, -5);
data.bottom = new FormAttachment(100, -5);
data.height = 200;
bottom.setLayoutData(data);
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}

"Stephen" <swmk.stephen@gmail.com> wrote in message
news:4ad09448e9913f6983528fd4f44acf4d$1@www.eclipse.org...
> Hi,
>
> I'm facing some problem. I have three composite in a composite.
>
> The top and bottom composite are fixed sized in height.
> The middle one may vary in size.
> And the parent composite is resizable.
>
> The problem is ;
> when a parent composite is resized, the bottom composite comes to the area
> of top composite.
> I use "top composite" for the "top" form attachment of middle composite
> and don't know what to put as the "bottom" attachment of the "bottom
> composite".
>
> The idea is like a window with title bar and status bar.
>
> --
> Thanks
>
Re: FormLayout [message #465579 is a reply to message #465564] Thu, 15 December 2005 14:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: wei.xie.lehman.com

Why don't use a gridlayout.
Re: FormLayout [message #465643 is a reply to message #465570] Fri, 16 December 2005 00:52 Go to previous messageGo to next message
Stephen is currently offline StephenFriend
Messages: 47
Registered: July 2009
Member
Thank you for your reply.
I have tried in such way. There's no problem when the parent composite is
not resized. When the parent composite is rezied, the bottom composite
went to the under of top composite.

--
Thanks;
Stephen
Re: FormLayout [message #465656 is a reply to message #465643] Fri, 16 December 2005 10:03 Go to previous message
Stefan Langer is currently offline Stefan LangerFriend
Messages: 236
Registered: July 2009
Senior Member
You should attach top of top composite to new FormAttachement(0,0);
Then attach middle to top new FormAttachement(top, margin);
Then attach bottom to middel composite new FormAttachement(middle, margin);
then attach bottom of bottom to bottom of parent compsoite new
FormAttachement(100,margin);
Do not attach bottom of top composite to middel composite and do not
attach bottom of middel composite to top of bottom composite.
At Last set a default size for all composites beyond which they cannot
be collapsed further.

Regards
Stefan

Stephen wrote:
> Thank you for your reply.
> I have tried in such way. There's no problem when the parent composite
> is not resized. When the parent composite is rezied, the bottom
> composite went to the under of top composite.
>
> --
> Thanks;
> Stephen
>
Previous Topic:KTable and Eclipse Forms
Next Topic:Setting context menu on editable CCombo
Goto Forum:
  


Current Time: Sat Sep 21 00:45:50 GMT 2019

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

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

Back to the top