Text Editor Example?

Was there at one time, a Text Editor example in the Xojo examples folder?

I just looked there and can’t find anything - really annoying as I now need to look into text editing capabilities :frowning:

Examples/Sample Projects/XojoText

Also see the related webinars:



Thanks Paul.

I downloaded the latest version of Xojo and then found the XojoText example project - however, when I tried to run it - it threw a NilObjectException.

I guess I will need to watch the 2 webinar videos later.

Thank you.

Alas a bug slipped in related to loading the preferences (it assumes the file exists, when it won’t the first time you run it).

Update App.LoadPreferences with this code to fix it:

[code] Dim prefFolder As FolderItem
#If DebugBuild Then
prefFolder = SpecialFolder.Desktop.Child(“XojoText”)
prefFolder = SpecialFolder.ApplicationData.Child(“XojoText”)

If prefFolder <> Nil Then

Dim prefFile As FolderItem = prefFolder.Child("XojoText.json")
If prefFile <> Nil And prefFile.Exists Then
  Dim tis As TextInputStream
  tis = TextInputStream.Open(prefFile)
  Dim prefs As JSONItem
  prefs = New JSONItem(tis.ReadAll)
  FontName = prefs.Value("FontName")
  FontSize = prefs.Value("FontSize")
End If

End If[/code]

Thanks Paul.

That now works, but the file wasn’t quite what I expected.
I was really looking for a text editor example with the capability of choosing colour, emboldening text, underlining text etc.

I would have liked to be able to examine existing code to see how all that kind of stuff is implemented.

Thank you for trying to help anyway.

Example with TextColor Font and TextSize


Danke Schön - genau das was Ich gesücht habe :slight_smile:

Really struggling with trying to create underline, bold, and italic toggle buttons :frowning:
I am sure I saw a video somewhere on how to create these, but can’t find it now.

Does anyone know of any videos detailing this?

in the Action Event of the button

TextArea1.SelUnderline = true

TextArea1.SelBold = true

TextArea1.SelItalic = true


What I have done is set this post as answered, and started a different post with a few TextField questions combined. This way I do not have to create lots of posts.
My TextEditor problems are now combined in a post called 2 Text Editor Questions.

Basically, all is now ok, apart from the buttons not toggling and the buttons captions not recognising italic or underline.

Thank you for your understanding.