non-scrolling form anywhere? [message #536537] |
Fri, 28 May 2010 14:53 |
Mauro Condarelli Messages: 428 Registered: September 2009 |
Senior Member |
|
|
Hi,
the layout in my FormToolkit-based editor is completely bogus due to scrollbar handling conflict between different levels of abstraction.
See below for a (hopefully) meaningful selection of the code.
Problem is the main page (WorldOverviewPage) gets a ScrolledForm from the Toolkit and I could not find how to disable this feature.
On the other hand the contents of the various composite_# and, most notably, the Tree do show their own vertical scrollbars.
This results in the need to scroll two components to get to the right place; this is obviously unacceptable.
Exactly the same (odd) behavior can be seen in IDE plugin.xml editor in the Extensions page:
If the tree on left is fully expanded and the whole page is too small You will have two nested scrolled controls.
In my case the effect is much worse because my Tree is much bigger.
Is there any way to force managedForm.getForm not to display scrollbars? (forcing the contained widgets to use their own).
Otherwise I will be forced to ditch Toolkit :(
Thanks in Advance
Mauro
public class WorldEditor extends FormEditor {
....
@Override
protected void addPages() {
try {
addPage(new WorldOverviewPage(this, WorldOverviewPage.ID, "World Overview"));
addPage(new SceneEditPage2(this, SceneEditPage2.ID, "Scene Edit"));
} catch (PartInitException e) {/*ignore*/}
}
....
}
public class WorldOverviewPage extends FormPage {
....
@Override
protected void createFormContent(IManagedForm managedForm) {
FormToolkit toolkit = managedForm.getToolkit();
ScrolledForm form = managedForm.getForm();
form.setText("World Overview");
Composite body = form.getBody();
toolkit.decorateFormHeading(form.getForm());
toolkit.paintBordersFor(body);
WorldMasterBlock wmBlock = new WorldMasterBlock(this);
wmBlock.createContent(managedForm);
}
....
}
public class WorldMasterBlock extends MasterDetailsBlock {
....
@Override
protected void createMasterPart(final IManagedForm managedForm, Composite parent) {
toolkit = managedForm.getToolkit();
//
Section sctnWorldOverview_1 = toolkit.createSection(parent, ExpandableComposite.EXPANDED | ExpandableComposite.TITLE_BAR);
sctnWorldOverview_1.setText("World Overview");
//
Composite composite = toolkit.createComposite(sctnWorldOverview_1, SWT.NONE);
toolkit.paintBordersFor(composite);
sctnWorldOverview_1.setClient(composite);
composite.setLayout(new GridLayout(1, false));
Section sctnWorldOverview = toolkit.createSection(composite, Section.COMPACT | Section.EXPANDED | Section.TWISTIE | Section.TITLE_BAR);
sctnWorldOverview.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
toolkit.paintBordersFor(sctnWorldOverview);
sctnWorldOverview.setText("Overview");
Composite composite_1 = toolkit.createComposite(sctnWorldOverview, SWT.NONE);
toolkit.paintBordersFor(composite_1);
sctnWorldOverview.setClient(composite_1);
GridLayout gl_composite_1 = new GridLayout(2, false);
gl_composite_1.marginHeight = 0;
composite_1.setLayout(gl_composite_1);
...
Section sctnWorldContents = toolkit.createSection(composite, Section.COMPACT | Section.EXPANDED | Section.TWISTIE | Section.TITLE_BAR);
sctnWorldContents.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
toolkit.paintBordersFor(sctnWorldContents);
sctnWorldContents.setText("Contents");
final SectionPart spart = new SectionPart(sctnWorldContents);
managedForm.addPart(spart);
Composite composite_2 = toolkit.createComposite(sctnWorldContents, SWT.NONE);
sctnWorldContents.setClient(composite_2);
toolkit.paintBordersFor(composite_2);
composite_2.setLayout(new FillLayout(SWT.HORIZONTAL));
Tree tree = toolkit.createTree(composite_2, SWT.BORDER);
toolkit.paintBordersFor(tree);
tree.setHeaderVisible(true);
tree.setLinesVisible(true);
tViewer = new TreeViewer(tree);
tViewer.setAutoExpandLevel(2);
...
}
....
}
|
|
|
Powered by
FUDForum. Page generated in 0.02967 seconds