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();
}
}