Bug reading rtf file from Apple’s TextEdit App

The code below loads an rtf file and display its contents in a TextArea.

Exempted the line where I added a link (select text, cmd-k, paste the URL, close in TextEdit).

Nota: I do not found a piece of code in the docs that shows how to load an rtf file, so I wrote my own:


Var Type_RTF As New FileType
Type_RTF.Name = "text/r*ch"
Type_RTF.Extensions = "rtf"


Var RTF_File_FI As FolderItem


RTF_File_FI = FolderItem.ShowOpenFileDialog(Type_RTF)

Var RTF_BS As BinaryStream

RTF_BS = BinaryStream.Open(RTF_File_FI, False)

TA.StyledText.RTFData = RTF_BS.Read(RTF_File_FI.Length)

RTF_BS.Close
RTF_File_FI = Nil

TextArea doesn’t support hyperlinks.

Thank you BOB FOR THIS XOJO ANSWER (answer à la Xojo).

The line with an URL is skipped at load time (blank line, not the text only or the text followed by the URL nor…).

In reality, you can have links there and far more. The problem lie in the usability (loads, save, set).

Also, xojo rtf implementation was started and stopped too early. Not even half baked.

My legs hurts.

If you need hyperlinks, embedded text Formatted Text Control is a good choice. It’s not a drop-in replacement for TextArea but it does work.

Thank you Bob.