[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform.swt] Re: Can't place Widgets in Group using FormLayout

I am on the road and don't have acces to my original code.  I must've done
something wrong because the code I just wrote to recreate the problem works.

TabFolder folder = new TabFolder (parent, SWT.NONE);

FormLayout layout = new FormLayout();

FormData formData = new FormData();

layout.marginHeight = 5;

layout.marginWidth = 5;

folder.setLayout (layout);


TabItem item = new TabItem(folder, SWT.NONE);

item.setText("page1");


Composite page = new Composite (folder, SWT.NONE);

layout = new FormLayout();

formData = new FormData();

layout.marginHeight = 5;

layout.marginWidth = 5;

page.setLayout (layout);


Group group = new Group(page, SWT.NONE);

layout.marginHeight = 25;

layout.marginWidth = 60;

layout = new FormLayout();

formData = new FormData();

formData.width = 200;

formData.height = 200;

formData.top = new FormAttachment(page, 50);

formData.left = new FormAttachment(page, 50);

group.setLayout (layout);

//group.setLayoutData(formData);


Button button = new Button(group, SWT.PUSH);

button.setText("New Button");

formData = new FormData();

formData.top = new FormAttachment(0, 5);

formData.left = new FormAttachment(0, 5);

button.setLayoutData (formData);


Button button2 = new Button(group, SWT.PUSH);

button2.setText("New Button2");

formData = new FormData();

formData.top = new FormAttachment(0, 5);

formData.left = new FormAttachment(button, 20);

button2.setLayoutData (formData);


Button button3 = new Button(group, SWT.PUSH);

button3.setText("New Button3");

formData = new FormData();

formData.top = new FormAttachment(0, 5);

formData.right = new FormAttachment(100, -5);

formData.bottom = new FormAttachment(100, -5);

formData.left = new FormAttachment(button2, 20);

button3.setLayoutData (formData);


item.setControl(page);

item = new TabItem(folder, SWT.NONE);

item.setText("page2");

"Veronika Irvine" <veronika_irvine@xxxxxxx> wrote in message
news:b8j72r$ner$1@xxxxxxxxxxxxxxxx
> Perhaps you could post a code snippet of what you are trying to do - or a
> sketch of the result you want.
>
> Also, see:
>
http://www.eclipse.org/articles/Understanding%20Layouts/Understanding%20Layo
> uts.htm
>
>
> "Zheng Yi" <mantis713@xxxxxxxxxxx> wrote in message
> news:b8gvc2$c28$1@xxxxxxxxxxxxxxxx
> > I am trying to place widgets within a group on a tabbed page.  I am not
> sure
> > how to do this because there are no form attachments tha tyou can use to
> > place widgets within a group. All help is appreciated.
> >
>
>