Can't layout appropriately using FormLayout [message #460299] |
Tue, 23 August 2005 20:19 |
Eclipse User |
|
|
|
Originally posted by: murley.murley.murley
Hi,
I am using FormLayout in my application. Now i have several problems that
i meet:
1) after i layout all components using formlayout, i cannot retrieve exactly
the size of each components. (My idea is create a Table, because of this, i
can't call table.setSize() to fit the apps.)
2) the 'bottom' cannot shown in my apps.
Below is the source code for my components, could anyone can give me a hand
for help, i am really frustrated in it. thanks...
//////////////////////////////////////////////////////////// ///////////
// TODO: a toolbar
Button toolBar = new Button(shell, SWT.PUSH | SWT.LEFT);
toolBar.setText("TODO: ToolBar");
FormData tbData = new FormData();
tbData.left = new FormAttachment(0);
tbData.right = new FormAttachment(100);
tbData.top = new FormAttachment(0);
tbData.bottom = new FormAttachment(5);
toolBar.setLayoutData(tbData);
//////////////////////////////////////////////////////////// ///////////////
Button heading = new Button(shell, SWT.PUSH | SWT.LEFT);
heading.setText("Heading");
FormData headingData = new FormData();
headingData.top = new FormAttachment(toolBar, 0);
headingData.left = new FormAttachment(toolBar, 0, SWT.LEFT);
headingData.right = new FormAttachment(100);
// headingData = new FormAttachment(7);
heading.setLayoutData(headingData);
//////////////////////////////////////////////////////////// /////////////////
Button sashForm = new Button(shell, SWT.PUSH | SWT.LEFT);
sashForm.setText("this part i will create a table");
FormData sashData = new FormData();
sashData.left = new FormAttachment(heading, 0, SWT.LEFT);
sashData.right = new FormAttachment(100);
sashData.top = new FormAttachment(heading, 0);
sashData.bottom = new FormAttachment(97);
sashForm.setLayoutData(sashData);
///////////////////////////////////////////////
Button bottom = new Button(shell, SWT.PUSH | SWT.LEFT);
bottom.setText("Bottom");
FormData bottomData = new FormData();
bottomData.left = new FormAttachment(sashForm, 0, SWT.LEFT);
bottomData.right = new FormAttachment(100);
bottomData.top = new FormAttachment(sashForm);
bottomData.bottom = new FormAttachment(2);
bottom.setLayoutData(bottomData);
Thanks for help
Best regards,
murley
|
|
|
Powered by
FUDForum. Page generated in 0.03666 seconds