Label with hypertext link inside


#1

Hi all,
I am trying to draw text with a hypertext link inside it like this:
some text before some text after.
I tried it with Labels and HyperlinkButton but it is not easy to position them correctly.
Is there something easier to do this?

Thanks in advance
Kevin


#2

You could do something like this:

void arrangeLabelsHorizontally (Label& label1, Label& label2)
{
  label1.setBorderSize (0, 0);
  label2.setBorderSize (0, 0);
  int w = label1.getFont().getStringWidth (label1.getText());
  label2.setTopLeftPosition (label1.getBounds.getRight() + w, label1.getBounds.getY());
  label2.setSize (label2->getFont().getStringWidth (label2->getText()), label1->getBounds().getHeight());
}

Now call arrangeLabelsHorizontally() for each pair of labels in succession. Be sure to set the fonts and strings ahead of time. The labels will have to include their own spaces. For example, the first label will need a space at the end of the text.


#3

Thanks for the answer.
I finally did something very specific to my problem because I had several line of text to draw.
Thanks to Pixie it was not so difficult but I will not be able to reuse it after.

Kevin