views:

135

answers:

0

i have created a View which contains 1 ScrolledForm only. All Children Composites of this ScrolledForm are instantiated with GridLayout and the depest children are created with a FormLayout.

        mForm = toolkit.createScrolledForm(this);
        mForm.setExpandHorizontal(true);
        mForm.setExpandVertical(true);
        mForm.setLayout(new GridLayout(1, true));
        mForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

        mForm.getBody().setLayout(new GridLayout(1, true));
        mForm.getBody().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

        intializeComposite(mForm.getBody());

I have added a listener to hide the Composites, which were created with the FormLayout. The hide logic is like.

if (mVisible) {
    mGridData.heightHint = -1;
} else {
    mGridData.heightHint = 0;
}

To refresh the composites i have to call layout(true,true) of the ScrolledForm of the View and the composites are visible or hidden.

Problem:

  • When the view is maximized the vertical scroll bar is shown only, when the composites height is to large.
  • When the view is minimized the horizontal scroll bar is shown, when the composite width is to large.
  • It never happens, that both Scroll bars are shown. Also when the width and height are to large at the same time.

Question:

  • Why can i not use both scroll bars?
  • Does my hide logic kill the scroll bars?
  • How do you hide Composites?