Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Hyperlink wrapping in ScrolledForm
Hyperlink wrapping in ScrolledForm [message #462806] Wed, 19 October 2005 20:54 Go to next message
Todd Chambery is currently offline Todd ChamberyFriend
Messages: 31
Registered: July 2009
Member
Hi all,

I can't get wrapping working for a Hyperlink in a ScrolledForm. I some
cases can get the links to show, but either 1) the horizontal scroll
appears, or 2) no scroll, but the links are chopped at the Form border.

What I'm looking for is no H_SCROLL and V_SCROLL as necessary.

Anyone have any experience with this?

Thanks,
Todd


Below is my test code (chopping example):

public class HyperlinkTester {

public HyperlinkTester() {
super();
}

/**
* @param args
*/
public static void main(String[] args) {
Display display = new Display();

Shell shell = new Shell(display);
shell.setLayout(new FillLayout());

FormToolkit toolkit = new FormToolkit(display);
ScrolledForm form = new ScrolledForm(shell, SWT.V_SCROLL);
form.setExpandHorizontal(true);
form.setExpandVertical(true);
// form.setBackground(colors.getBackground());
// form.setForeground(colors.getColor(FormColors.TITLE));
// form.setFont(JFaceResources.getHeaderFont());
// final ScrolledForm form = toolkit.createScrolledForm(shell);

for (int i = 0; i <= 4; i++) {
Composite c = toolkit.createComposite(form);
final Hyperlink href = new Hyperlink(form.getBody(), SWT.WRAP);
href
.setText("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 ");
// href.setForeground(new Color(null, 0, 0, 255));
href.setFocus();
href.setUnderlined(true);

// TableWrapData twd = new TableWrapData();
// twd.
// href.setLayoutData();
}
TableWrapLayout layout = new TableWrapLayout();
layout.bottomMargin = 12;
layout.topMargin = 12;
layout.leftMargin = 12;
layout.rightMargin = 12;
layout.verticalSpacing = 5;
layout.numColumns = 1;
layout.makeColumnsEqualWidth = false;
// RowLayout layout = new RowLayout(SWT.HORIZONTAL);
// layout.wrap = true;
form.getBody().setLayout(layout);

form.setExpandVertical(true);
form.setExpandHorizontal(true);
shell.setSize(350, 200);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}

}
Re: Hyperlink wrapping in ScrolledForm [message #462896 is a reply to message #462806] Thu, 20 October 2005 14:48 Go to previous messageGo to next message
Patrick Paulin is currently offline Patrick PaulinFriend
Messages: 42
Registered: July 2009
Member
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();
}
}
Re: Hyperlink wrapping in ScrolledForm [message #462940 is a reply to message #462896] Fri, 21 October 2005 14:56 Go to previous messageGo to next message
Todd Chambery is currently offline Todd ChamberyFriend
Messages: 31
Registered: July 2009
Member
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();
> }
> }
>
>
Re: Hyperlink wrapping in ScrolledForm [message #462948 is a reply to message #462940] Fri, 21 October 2005 17:23 Go to previous message
Patrick Paulin is currently offline Patrick PaulinFriend
Messages: 42
Registered: July 2009
Member
Todd Chambery wrote:

> Thanks for the sanity check. I've been wringing it every which way for
> a couple days with no success.

No problem. I filed a bug report, as that's probably the best way to
proceed. The bug is https://bugs.eclipse.org/bugs/show_bug.cgi?id=113382.

> Were you able to "fake" wrapping hyperlinks with FormText or Label?

No, but that's a great idea. I'll try it as a short-term fix.

Thanks,

--- Patrick
Previous Topic:Swing Vs SWT Problems.
Next Topic:Saving and retrieving StyledText to/from database
Goto Forum:
  


Current Time: Wed Apr 24 20:22:42 GMT 2024

Powered by FUDForum. Page generated in 0.03674 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top