|
Re: Eclipse Forms and JFace Dialog [message #327215 is a reply to message #327207] |
Mon, 14 April 2008 10:45 |
Eclipse User |
|
|
|
Originally posted by: tom.seidel.spiritlink.de
You don't set a LayoutData on the forms body.
Cheerz,
Tom
Matthias schrieb:
> Hi!
>
> I want to create a JFace dialog which uses the Eclipse Forms in its
> dialog area. But I can't managed it to get it working. The Scrolled Form
> area is very small and does not fit into the dialog's area: when I
> resize the dialog, the scrolled form does not resize either!
>
> How can I set the default size of the dialog?
>
> Here is my code:
>
> public class MyPropertyDialogextends Dialog {
>
> private FormToolkit toolkit;
>
> private ScrolledForm form;
>
> public MyPropertyDialog(Shell parentShell) {
>
> super(parentShell);
>
> setShellStyle(getShellStyle() | SWT.RESIZE);
> }
>
> @Override
> protected Control createDialogArea(Composite parent) {
>
> Composite parentComposite =
> (Composite)super.createDialogArea(parent);
>
> toolkit = new FormToolkit(parent.getDisplay());
>
> form = toolkit.createScrolledForm(parentComposite);
> form.setText("Edit trigger");
>
> Composite composite = form.getBody();
>
> final GridLayout layout = new GridLayout(2, true);
> composite.setLayout(layout);
>
> GridData gd = new GridData();
> Section cronSection = toolkit.createSection(composite,
> Section.EXPANDED | Section.TWISTIE | Section.TITLE_BAR);
> cronSection.addExpansionListener(new SectionExpansionAdapter());
> cronSection.setText("Cron");
> gd.horizontalSpan = 1;
> cronSection.setLayoutData(gd);
>
> cronSection.setClient(createCronSection(cronSection));
>
> Section tableSection = toolkit.createSection(composite,
> Section.TITLE_BAR | Section.EXPANDED);
> tableSection.addExpansionListener(new SectionExpansionAdapter());
> tableSection.setText("All");
> tableSection.setLayoutData(gd);
>
> tableSection.setClient(createTableSection(tableSection));
>
> Section simpleSection = toolkit.createSection(composite,
> Section.TWISTIE | Section.TITLE_BAR);
> simpleSection.addExpansionListener(new SectionExpansionAdapter());
> simpleSection.setText("Simple");
> simpleSection.setLayoutData(gd);
>
> simpleSection.setClient(createSimpleSection(simpleSection));
>
> //parentComposite.getShell().setSize(400,400);
>
> return parentComposite;
> }
>
> protected Composite createCronSection(Section section) {
>
> Composite container = toolkit.createComposite(section);
>
> return container;
> }
>
> protected Composite createSimpleSection(Section section) {
>
> Composite container = toolkit.createComposite(section);
>
> return container;
> }
>
> protected Composite createTableSection(Section section) {
>
> Composite container = toolkit.createComposite(section);
>
> return container;
> }
>
> class SectionExpansionAdapter extends ExpansionAdapter {
>
> @Override
> public void expansionStateChanged(ExpansionEvent e) {
>
> form.reflow(true);
> }
>
> }
>
> }
>
>
>
>
> What am I doing wrong here?!?
>
> Best regards,
> Matthias
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03463 seconds