ja się spotkałem tego problemu kilka razy i rozwiązać go tak:
@Override
protected void createFormContent(IManagedForm managedForm) {
// set the form's body's layout to GridLayout
final Composite body = managedForm.getForm().getBody();
body.setLayout(new GridLayout());
// create the composite which should not have the scrollbar and set its layout data
// to GridData with width and height hints equal to the size of the form's body
final Composite notScrolledComposite = managedForm.getToolkit().createComposite(body);
final GridData gdata = GridDataFactory.fillDefaults()
.grab(true, true)
.hint(body.getClientArea().width, body.getClientArea().height)
.create();
notScrolledComposite.setLayoutData(gdata);
// add resize listener so the composite's width and height hints are updates when
// the form's body resizes
body.addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
super.controlResized(e);
gdata.widthHint = body.getClientArea().width;
gdata.heightHint = body.getClientArea().height;
notScrolledComposite.layout(true);
}
});
}
Zawiadomienie GridLayout
w organizmie formularza, a następnie ustawiając szerokość i wysokość hint
do kompozytowy: GridLayoutData
.
Zwróć także uwagę na zmianę rozmiaru obiektu nasłuchującego na ciele, który aktualizuje dane układu siatki i układy kompozytowe.
Mam nadzieję, że pomoże!
Więc nie używaj scrolledform. Użyj innego pojemnika. – jarodeells
@jarodeells to dlatego, że metoda ManagedForm 'getForm()' zwraca ScrolledForm. (Http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi% 2Forg% 2Feclipse% 2Fui% 2Fforms% 2FManagedForm.html) –
Czy byłeś w stanie rozwiązać swój problem za pomocą przykładu @ janhink? Mam to, co wydaje się być tym samym problemem, ale nie jestem w stanie sprawić, aby to rozwiązanie działało, więc znalazłeś takie, które mnie interesuje, jak to działało. – NealSr