Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » no scrollbars when expanding section with managedform.reflow()
no scrollbars when expanding section with managedform.reflow() [message #452174] Mon, 14 March 2005 20:21 Go to next message
Eclipse UserFriend
I'm using the form programming sample code from the
org.eclipse.ui.forms.examples plugin, and have modified the
MasterDetailsBlock page so that TyepOneDetailsPage contains an expandable
section. My two code changes are shown with '*' below.

I cannot figure out why expanding the section s1 doesn't result in
scrollbars appearing - I thought the mform.reflow() in my expansion
listener should do that.

Scrollbars *do* appear when I select a new item in the sample's master
part, so there's definitely a scrollable parent in the widget hierarchy, I
just cannot trigger the addition of scrollbars with mform.reflow(). What
should I be calling in the expansion listener?

public void createContents(Composite parent) {
TableWrapLayout layout = new TableWrapLayout();
layout.topMargin = 5;
layout.leftMargin = 5;
layout.rightMargin = 2;
layout.bottomMargin = 2;
parent.setLayout(layout);
FormToolkit toolkit = mform.getToolkit();
Section s1 = toolkit.createSection(parent,
Section.DESCRIPTION|
* Section.TWISTIE|Section.COMPACT);
s1.marginWidth = 10;
s1.setText("Type One Details");
s1.setDescription("Set the properties of the selected TypeOne object.");
TableWrapData td = new TableWrapData(TableWrapData.FILL,
TableWrapData.TOP); td.grabHorizontal = true;
s1.setLayoutData(td);
toolkit.createCompositeSeparator(s1); Composite client =
toolkit.createComposite(s1); GridLayout glayout = new GridLayout();
glayout.marginWidth = glayout.marginHeight = 0; glayout.numColumns = 2;
client.setLayout(glayout);

* s1.addExpansionListener(new ExpansionAdapter() {
public void expansionStateChanged(ExpansionEvent e) {
mform.reflow(true);
}
});
... [rest of app is same as sample code]
Re: no scrollbars when expanding section with managedform.reflow () [message #452275 is a reply to message #452174] Wed, 16 March 2005 12:14 Go to previous messageGo to next message
Eclipse UserFriend
I have the same problem.
Any ideas?

Thanks.
Dimitry

>>> Jason<junk@logular.com> 3/14/2005 8:21:51 PM >>>
I'm using the form programming sample code from the
org.eclipse.ui.forms.examples plugin, and have modified the
MasterDetailsBlock page so that TyepOneDetailsPage contains an expandable
section. My two code changes are shown with '*' below.

I cannot figure out why expanding the section s1 doesn't result in
scrollbars appearing - I thought the mform.reflow() in my expansion
listener should do that.

Scrollbars *do* appear when I select a new item in the sample's master
part, so there's definitely a scrollable parent in the widget hierarchy, I
just cannot trigger the addition of scrollbars with mform.reflow(). What
should I be calling in the expansion listener?

public void createContents(Composite parent) {
TableWrapLayout layout = new TableWrapLayout();
layout.topMargin = 5;
layout.leftMargin = 5;
layout.rightMargin = 2;
layout.bottomMargin = 2;
parent.setLayout(layout);
FormToolkit toolkit = mform.getToolkit();
Section s1 = toolkit.createSection(parent,
Section.DESCRIPTION|
* Section.TWISTIE|Section.COMPACT);
s1.marginWidth = 10;
s1.setText("Type One Details");
s1.setDescription("Set the properties of the selected TypeOne object.");
TableWrapData td = new TableWrapData(TableWrapData.FILL,
TableWrapData.TOP); td.grabHorizontal = true;
s1.setLayoutData(td);
toolkit.createCompositeSeparator(s1); Composite client =
toolkit.createComposite(s1); GridLayout glayout = new GridLayout();
glayout.marginWidth = glayout.marginHeight = 0; glayout.numColumns = 2;
client.setLayout(glayout);

* s1.addExpansionListener(new ExpansionAdapter() {
public void expansionStateChanged(ExpansionEvent e) {
mform.reflow(true);
}
});
... [rest of app is same as sample code]
Re: no scrollbars when expanding section with managedform.reflow () [message #452278 is a reply to message #452275] Wed, 16 March 2005 13:45 Go to previous messageGo to next message
Eclipse UserFriend
I figured out a solution that works althoght it looks like a hack.

In the detail part I store the parent and in the expand event for the section do the following:
((SharedScrolledComposite)(parent.getParent().getParent())). reflow(true);

Esentially you need to get to the ScrolledPageBook that holds detail pages and call reflow on it.

I suspect that the reason mform.reflow(true); does not work is the bug someware in the WrappedPageBook
that does not propagate reflow methods to child pages.

Dimitry.

>>> Dimitry Fayerman<dfayerma@wyeth.com> 3/16/2005 12:14:01 PM >>>
I have the same problem.
Any ideas?

Thanks.
Dimitry

>>> Jason<junk@logular.com> 3/14/2005 8:21:51 PM >>>
I'm using the form programming sample code from the
org.eclipse.ui.forms.examples plugin, and have modified the
MasterDetailsBlock page so that TyepOneDetailsPage contains an expandable
section. My two code changes are shown with '*' below.

I cannot figure out why expanding the section s1 doesn't result in
scrollbars appearing - I thought the mform.reflow() in my expansion
listener should do that.

Scrollbars *do* appear when I select a new item in the sample's master
part, so there's definitely a scrollable parent in the widget hierarchy, I
just cannot trigger the addition of scrollbars with mform.reflow(). What
should I be calling in the expansion listener?

public void createContents(Composite parent) {
TableWrapLayout layout = new TableWrapLayout();
layout.topMargin = 5;
layout.leftMargin = 5;
layout.rightMargin = 2;
layout.bottomMargin = 2;
parent.setLayout(layout);
FormToolkit toolkit = mform.getToolkit();
Section s1 = toolkit.createSection(parent,
Section.DESCRIPTION|
* Section.TWISTIE|Section.COMPACT);
s1.marginWidth = 10;
s1.setText("Type One Details");
s1.setDescription("Set the properties of the selected TypeOne object.");
TableWrapData td = new TableWrapData(TableWrapData.FILL,
TableWrapData.TOP); td.grabHorizontal = true;
s1.setLayoutData(td);
toolkit.createCompositeSeparator(s1); Composite client =
toolkit.createComposite(s1); GridLayout glayout = new GridLayout();
glayout.marginWidth = glayout.marginHeight = 0; glayout.numColumns = 2;
client.setLayout(glayout);

* s1.addExpansionListener(new ExpansionAdapter() {
public void expansionStateChanged(ExpansionEvent e) {
mform.reflow(true);
}
});
... [rest of app is same as sample code]
Re: no scrollbars when expanding section with managedform.reflow () [message #452292 is a reply to message #452278] Wed, 16 March 2005 21:28 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Dimitry,

That does the trick. I spent a lot of hours on this one, and to be
honest, I still don't fully understand the distinctions between reflow(),
layout(), pack(), redraw(), etc., nor how they propagate up/down a
hierarchy of SWT components/forms. It would be good if somebody in the
know could write a little on these - I have colleagues who have also spent
a lot of time fiddling with reflow() and layout().

I think you're right. For some reason, the mform.reflow() doesn't affect
the ScrolledComposite. Seems like a bug to me.

The other curious thing about this is that the expanding section
sends a reflow() up the hierarchy by default, but this also does nothing
to the scrollbars.

For the benefit of others, here're the other things that I tried in my
expansion handler, to no avail:

public void expansionStateChanged(ExpansionEvent e) {

// exifSection.layout(true);
// exifSection.pack(true);
// exifSection.notifyListeners(SWT.Resize, new Event());

// mform.reflow(true);
// mform.getForm().layout();
// mform.getForm().reflow(true); // This is what mform.reflow() does
// mform.getForm().redraw();
// mform.getForm().notifyListeners(SWT.Resize, new Event());

// parent.getParent().getParent().layout(true);
((SharedScrolledComposite)(parent.getParent().getParent())). reflow(true);
}
Re: no scrollbars when expanding section with managedform.reflow () [message #701874 is a reply to message #452292] Mon, 25 July 2011 13:43 Go to previous message
Eclipse UserFriend
As July 2011 I had to do only the following:

form.reflow(true);
form.getParent().layout(true,true);

Hope it helps somebody out there.

Fran
Previous Topic:SWT browser bug
Next Topic:neither paintItem nor paintListener working well for rendering in my table
Goto Forum:
  


Current Time: Mon Jul 07 10:22:24 EDT 2025

Powered by FUDForum. Page generated in 0.06141 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top