TextArea RTFData Hyperlink As Input

Hi there!

I built a method that converts an HTML-Input into RTFData like this:

<a href="https://forum.xojo.com/">Xojo Forum</a>

Converts to

{\rtf1\ansi\ansicpg1252{\fonttbl{\f0\fnil Segoe UI;}}{\colortbl\red0\green0\blue0;}\uc0 \ql\f0\fs24 {\field{\*\fldinst HYPERLINK "https://forum.xojo.com/"}{\fldrslt Xojo Forum}}}

When I take this as Input for my Text_Area.StyledText.RTFData it doesnt output anything.

Does the TextArea in Xojo support Hyperlinks or did I do anything wrong with the conversion?

Thanks for your help :slight_smile:

As far as I remember there is a blog post from Javier Menendez on the Xojo blog on how to add html links to a TextArea. I wasn’t able to find it, though.

Is this the one you are looking for?

1 Like

Yes.

1 Like

Thanks a lot for your fast responses!

I will try to make it work but for my current usecase its a little to laborious.

So there is no “easy” way to just activate the ability of TextAreas to detect the Hyperlink out of the RTFData?

I also found the way to make clickable Lables with the Xojo Programming Textbook which is very easy to implement. But it doesnt help me in adding the Hyperlink in a Textarea (which it needs to be for my usecase) - Xojo: Learn Xojo Programming

1 Like

I had the same problem. That’s why I made a feature request: Allow embedding of Hypertext

Since the feature request has not led to any results so far, I tried to solve the problem myself (started strong and then slowed down a lot due to time constraints). The solution is therefore stuck at the experimental stage.

For the handling of URL/links in a TextArea I only see a solution with MBS plugins. I have managed to load and handle ASCII, RTF and RTFD text files with it.

as workaround maybe use style underlined and blue with readable url in rtf

I had to fight once back with the limitations of textareas, and the differences between macos and windows of them. so I changed to an htmlviewer and there you can make almost anything you want.
there are methods you can find to transform rtf to html, that’s the easiest way to go.
you can also implement some free javascript libraries like summernote or quill insode this htmlviewer and so you have a fully working text editor.


you also have toast markdown available and you get a wysiwyg markdown editor…

4 Likes

Looks really good. Will you able to share the code or want to sell it.

1 Like

for now the code is too inside other codes so it’s not usable as is…
I would have to extract it and make a sample project, but why not
it was quite easy though I don’t remember having too much work for this.

and as it is based on free libraries, I don’t know if I’m allowed to sell something based on them…

It would be great if you could extract and share a sample project as i am not an expert in executing java scripts.

If you’re not an expert you should check out a maintained library like GraffitiEditor because having built one myself, I can tell you it is nowhere near as simple as it’s been made out to be.

The source of this problem, for anyone wondering, is that Xojo’s RTF handling is a custom implementation that does not support hyperlinks.

2 Likes