FormLayout [message #465564] |
Thu, 15 December 2005 08:25  |
Eclipse User |
|
|
|
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 09:10   |
Eclipse User |
|
|
|
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 #465656 is a reply to message #465643] |
Fri, 16 December 2005 05:03  |
Eclipse User |
|
|
|
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
>
|
|
|
Powered by
FUDForum. Page generated in 0.11233 seconds