Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Problems with Frame toolkit
Problems with Frame toolkit [message #520773] Mon, 15 March 2010 05:53
Mauro Condarelli is currently offline Mauro Condarelli
Messages: 415
Registered: September 2009
Senior Member
Hi,
I'm writing a (somewhat complex) interface using Frames.
Current problem is I seem unable to control size of various elements
(probably a layout problem).

I have a master/details form; the details is as follows (I send the
whole createContents() because I'm unsure about what's relevant;
comments below):

public class SceneDetailsPage implements IDetailsPage {
....
public void createContents(Composite parent) {
FormToolkit toolkit = managedForm.getToolkit();
parent.setLayout(new FillLayout());
//
Section sctnBook = toolkit.createSection(parent,
ExpandableComposite.EXPANDED | ExpandableComposite.TITLE_BAR);
sctnBook.setText("Scene");
//
Composite composite = toolkit.createComposite(sctnBook, SWT.NONE);
toolkit.paintBordersFor(composite);
sctnBook.setClient(composite);
composite.setLayout(new GridLayout(1, false));

Section sctnOverview = toolkit.createSection(composite,
Section.TWISTIE | Section.TITLE_BAR);
sctnOverview.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
true, true, 1, 1));
toolkit.paintBordersFor(sctnOverview);
sctnOverview.setText("Overview");

Composite composite_1 = toolkit.createComposite(sctnOverview,
SWT.NONE);
toolkit.paintBordersFor(composite_1);
sctnOverview.setClient(composite_1);
composite_1.setLayout(new GridLayout(2, false));

Label lblTitle = toolkit.createLabel(composite_1, "Title:",
SWT.NONE);
lblTitle.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER,
false, false, 1, 1));

txtTitle = toolkit.createText(composite_1, "Title", SWT.NONE);
txtTitle.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
false, 1, 1));

txtDesc = toolkit.createText(composite_1, "Desc", SWT.WRAP |
SWT.V_SCROLL | SWT.MULTI);
txtDesc.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
true, 2, 1));

Label lblWords = toolkit.createLabel(composite_1, "Words:",
SWT.NONE);
lblWords.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER,
false, false, 1, 1));

txtWords = toolkit.createText(composite_1, "Words", SWT.NONE);
txtWords.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
false, 1, 1));
sctnOverview.setExpanded(true);

Section sctnContent = toolkit.createSection(composite,
Section.TWISTIE | Section.TITLE_BAR);
sctnContent.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
true, true, 1, 1));
toolkit.paintBordersFor(sctnContent);
sctnContent.setText("Content");

txtContent = toolkit.createText(sctnContent, "Content",
SWT.WRAP | SWT.V_SCROLL | SWT.MULTI);
sctnContent.setClient(txtContent);
sctnContent.setExpanded(true);

initDataBindings();
}
...
}

The problem is when the size of "Content" grows so does the size of the
Text widget (txtContent) up to the point the previous section (sctnBook)
disappears completely (unless I use the twistie to hide sctnContent),
then a scrollbar appears at the top level (the vertical size of
txtContent is still growing!).
After further adding text a *second* scrollbar opens *in* txtContent and
it stops growing when I keep adding text.
This is plain ugly.
Expected behavior would be to have just a single scrollbar in txtContent
and no (excessive) shrinkage of sctnBook.

What am I doing wrong?
I tried several configurations, including wrapping in a scrollbox, but
that does not seem to help.

Thanks in Advance.
Mauro
Previous Topic:How to dispose ApplicationWindow
Next Topic:Rendering HTML Table in Eclipse FormText Control
Goto Forum:
  


Current Time: Fri Jul 25 18:23:04 EDT 2014

Powered by FUDForum. Page generated in 0.01502 seconds