[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: Hyperlink wrapping in ScrolledForm

Thanks for the sanity check. I've been wringing it every which way for a couple days with no success. Were you able to "fake" wrapping hyperlinks with FormText or Label?

Todd

Patrick Paulin wrote:
Todd Chambery wrote:

I can't get wrapping working for a Hyperlink in a ScrolledForm.


I've run into this problem as well. Hyperlinks don't seem to wrap in any form, whether it is a ScrolledForm or not. Here are two simplified snippets showing hyperlinks wrapping succesfully directly on the shell, and hyperlinks not wrapping on a form.

Sorry for the "me too" post, but I wanted to clarify that this problem occurs even when you use the toolkit methods to create the form and hyperlink.

--- Patrick


************* hyperlink wraps ok *******************

public class HyperlinkWrapPass {

    public HyperlinkWrapPass() {
        super();
    }

    /**
     * @param args
     */
    public static void main(String[] args) {

        Display display = new Display();
        Shell shell = new Shell(display);
        shell.setSize(350, 200);
        shell.setLayout(new FillLayout());

String text = "Could anyone please help me out in how to provide a hyperlink text using SWT. I got an example but its using html in SWT, and not working with other tools of SWT. Please could anyone help me out with an example including ";
final Hyperlink link = new Hyperlink(shell, SWT.WRAP);
link.setText(text);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}


************* hyperlink doesn't wrap *******************

public class HyperlinkWrapFail {

    public HyperlinkWrapFail() {
        super();
    }

    /**
     * @param args
     */
    public static void main(String[] args) {

        Display display = new Display();
        Shell shell = new Shell(display);
        shell.setSize(350, 200);
        shell.setLayout(new FillLayout());

        FormToolkit toolkit = new FormToolkit(display);
        Form form = toolkit.createForm(shell);
        form.getBody().setLayout(new TableWrapLayout());

String text = "Could anyone please help me out in how to provide a hyperlink text using SWT. I got an example but its using html in SWT, and not working with other tools of SWT. Please could anyone help me out with an example including ";
toolkit.createHyperlink(form.getBody(), text, SWT.WRAP);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}