Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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] Tue, 15 March 2005 01:21 Go to next message
Jason Grant is currently offline Jason GrantFriend
Messages: 77
Registered: July 2009
Member
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 17:14 Go to previous messageGo to next message
Dimitry Fayerman is currently offline Dimitry FayermanFriend
Messages: 14
Registered: July 2009
Junior Member
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 18:45 Go to previous messageGo to next message
Dimitry Fayerman is currently offline Dimitry FayermanFriend
Messages: 14
Registered: July 2009
Junior Member
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] Thu, 17 March 2005 02:28 Go to previous messageGo to next message
Jason Grant is currently offline Jason GrantFriend
Messages: 77
Registered: July 2009
Member
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 17:43 Go to previous message
Fran  is currently offline Fran Friend
Messages: 8
Registered: May 2011
Junior Member
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: Sun Dec 21 11:24:10 GMT 2014

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

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