Store long text

Is there any way to store a long text inside application something like notes in editor that can be accessed and displayed later?

If you mean display later in the IDE then you can add a note to any navigation panel item except perhaps a folder. If you want to display the text at runtime create a constant.

depends on what you need.
a Constant is a good way.

Also I often just pasted text in a hidden textarea on a window.

For some projects, I had a hidden mode where the app would show extra data in textareas which the normal user doesn’t see.

No, I mean for example readme/license/changelog/etc, that can be displayed in it’s own window.

I usually endoded the text using base64 and store it as a constant or computed property. But, Xojo editor will hang for a moment because it’s too long.

create a text file, add it to the project resources, access it later by its name

  • assume you make “MYTEXT.TXT”
  • drag it into your project
  • in the code access as “mytext”
dim s as string
s=myTEXT

be aware, there is like a 2gig limit here :slight_smile:

Create a string/Text constant and display it. No need to encodeBase64.

It’s not a sentence or two. It’s a whole text contains several paragraphs and list items.

the method I described can contain what ever your want… you can even use an RTF document and display it in a TEXTAREA complete with formatting

Yes, confirmed. Thank you. The text file will be stored inside project resource folder.

or you store a html file in resources folder and load it at runtime in HTMLViewer.

Whatever. As far as I know, a constant can contain dozens of kilobytes…

If you want formatting, put a RTF document in there and load it with StyledText.RTFData.

Placing a text file in the resources works too.

[quote=306331:@Michel Bujardet]Whatever. As far as I know, a constant can contain dozens of kilobytes…

If you want formatting, put a RTF document in there and load it with StyledText.RTFData.

Placing a text file in the resources works too.[/quote]
Thank you michel, I realize that constant provide an easy method to store a text.

Thank you all for the solution :slight_smile:

RTF in constant is no problem unless you are hit with some text encoding problem.
The constants are in UTF-8, your rtf content may not be.