Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Eclipse Forms section and reflow its parent -> No Scrollbars
Eclipse Forms section and reflow its parent -> No Scrollbars [message #439200] Wed, 07 July 2004 06:05 Go to next message
Andreas Martin is currently offline Andreas MartinFriend
Messages: 6
Registered: July 2009
Junior Member
Hallo!

My Name is Andreas Martin, this is my first post to this newsgroup. At
the moment I try build a standalone program with the new Eclipse forms api.

I created a MasterDetails formular and in the details page an normal
section and an expandable section. Next you can see the createContents
of the details page.


public void createContents(Composite parent) {

GridLayout gridLayout = new GridLayout();
gridLayout.marginWidth = gridLayout.marginHeight = 5;
gridLayout.numColumns = 1;
parent.setLayout(gridLayout);

// mform is the parent ManagedForm
FormToolkit toolkit = mform.getToolkit();

Section s1 = toolkit.createSection(parent, Section.DESCRIPTION);
s1.marginWidth = 10;
s1.setText("Details");
s1.setDescription("Eigenschaften des ausgewählten Containers.");

GridData gd;
gd = new GridData();
s1.setLayoutData(gd);

Composite client1 = toolkit.createComposite(s1);
gridLayout = new GridLayout();
gridLayout.marginWidth = gridLayout.marginHeight = 5;
gridLayout.numColumns = 2;
client1.setLayout(gridLayout);

toolkit.createLabel(client1, "Bezeichnung:");
txtBezeichnung = toolkit.createText(client1, "", SWT.SINGLE);
gd = new GridData(GridData.FILL_HORIZONTAL);
txtBezeichnung.setLayoutData(gd);
.... some more time again .....


s1.setClient(client1);
toolkit.paintBordersFor(client1);



Section s2 = toolkit.createSection(parent, Section.TWISTIE |
Section.DESCRIPTION);
s2.marginWidth = 10;
s2.setText("Details2");
s2.setDescription("Eigenschaften des ausgewählten Containers.2");


gd = new GridData();
// gd = new GridData(GridData.FILL_HORIZONTAL);
s2.setLayoutData(gd);

Composite client2 = toolkit.createComposite(s2);
gridLayout = new GridLayout();
gridLayout.marginWidth = gridLayout.marginHeight = 5;
gridLayout.numColumns = 2;
client2.setLayout(gridLayout);

toolkit.createLabel(client2, "Bezeichnung:");
txtBezeichnung = toolkit.createText(client2, "kaese", SWT.SINGLE);
gd = new GridData(GridData.FILL_HORIZONTAL);
txtBezeichnung.setLayoutData(gd);
.... some more time again .....


s2.addExpansionListener(new ExpansionAdapter() {
public void expansionStateChanged(ExpansionEvent e) {
ScrolledForm sForm = mform.getForm();
sForm.reflow(true);
}
});


s2.setClient(client2);
toolkit.paintBordersFor(client2);

toolkit.paintBordersFor(s1);
toolkit.paintBordersFor(s2);
}



For better explanation of the problem I made some screenshots:
http://www.perfectwww.de/temp/Picture1.jpg
http://www.perfectwww.de/temp/Picture2.jpg
http://www.perfectwww.de/temp/Picture3.jpg


In picture one you can see the state of the details page when I run the
program. When I expand the second section the result is in picture two,
no scrollbars are created when the managed parent form is reflowed cause
of the expansionStateChanged event.

On the upper right side I have two buttons to change the sashform
direction (of the masterdetails form) from vertical to horizontal and
back like in the Eclipse Forms examples. When I switch one time to
horizontal and back to vertical my details page is right, it has now
scrollbars. Look at picture three.

Has somebody any idea why the details page gets no scrollbars directly
when I only expand the section?


Many thanks
Andreas
Re: Eclipse Forms section and reflow its parent -> No Scrollbars [message #439993 is a reply to message #439200] Tue, 20 July 2004 11:58 Go to previous message
Jelle Herold is currently offline Jelle HeroldFriend
Messages: 42
Registered: July 2009
Member
Hi Andreas,

On 2004-07-07, Andreas Martin <a.martin@perfectwww.de> wrote:
> In picture one you can see the state of the details page when I run the
> program. When I expand the second section the result is in picture two,
> no scrollbars are created when the managed parent form is reflowed cause
> of the expansionStateChanged event.
>
> Has somebody any idea why the details page gets no scrollbars directly
> when I only expand the section?

I don't know ... but wrapping the details page in a ScrolledComposite
should automatically have the scrollbars appear when needed. Maybe you
need to ask the details page' layout manager to update it's layout using
Layout.layout() or do a redraw().

PS. longer messages tend to get skipped, try to keep them as short as
possible, see http://support.uchicago.edu/docs/ref/gen/newsetiq.html for
some tips.

Good Luck
Jelle
--
http://o2w.nl/~jelle/
http://defekt.nl/
Previous Topic:example of tabletreeviewer
Next Topic:Word MenuItems disabled (Headers/Footers)
Goto Forum:
  


Current Time: Sat Apr 27 01:48:30 GMT 2024

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

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

Back to the top