[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform] Eclipse ScrolledForm not scrolling.

Hi,

I've got an eclipse scrolled (V_SCROLL) that should scroll vertically.

However adding a lot of controls to the form does not make the form scroll.

Is there something obviously wrong that I'm doing?

This is the code snippet where I'm creating a lot of hyperlinks that
should be shown in using a rowlayout, that should wrap, and the form
should scroll vertically when there's too many hyperlinks that do not
fit in the viewable area.


--- begin code snippet ---

public static void main(String[] args) {
    Display display = new Display();
    Shell parent = new Shell(display, SWT.DIALOG_TRIM | SWT.RESIZE);
    parent.setLayout(new FillLayout());

    FormToolkit formToolkit = new FormToolkit(parent.getDisplay());

    final ScrolledForm form = new ScrolledForm(parent, SWT.V_SCROLL);
    form.setBackground(formToolkit.getColors().getBackground());
    form.setForeground(formToolkit.getColors().getColor(IFormColors.TITLE));
    form.setExpandHorizontal(true);
    form.setExpandVertical(true);
    form.setFont(JFaceResources.getHeaderFont());
    form.getBody().setLayout(new RowLayout());
    form.setText("Hello, Eclipse Forms");

    for (int i = 0; i < 200; i++)
        formToolkit.createHyperlink(form.getBody(), "hyperlink-" + i,
SWT.NONE);

    parent.setSize(300, 400);
    parent.open();

    while (!parent.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

--- end code snippet ---

-- 
Ketan Padegaonkar
I blog... therefore I am... http://ketan.padegaonkar.name/

The farther you go, the less you know.
		-- Lao Tsu, "Tao Te Ching"

Attachment: signature.asc
Description: OpenPGP digital signature