# Text Editor Example?

**URL:** <https://forum.xojo.com/t/text-editor-example/16097>\
**Category:** Getting Started\
**Created:** [April 29, 2014, 3:36pm UTC](https://forum.xojo.com/t/text-editor-example/16097 "2014-04-29T15:36:16Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Richard\_Summers](https://forum.xojo.com/user_avatar/forum.xojo.com/richard_summers/32/477_2.png) [@Richard\_Summers](https://forum.xojo.com/u/Richard_Summers)\
**Post date:** [April 29, 2014, 3:36pm UTC](https://forum.xojo.com/t/text-editor-example/16097/1 "2014-04-29T15:36:16Z")

</div>

Hi,  
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 ☹

---

<div class="post-metadata">

**Author:** ![Paul\_Lefebvre](https://forum.xojo.com/user_avatar/forum.xojo.com/paul_lefebvre/32/3152_2.png) [@Paul\_Lefebvre](https://forum.xojo.com/u/Paul_Lefebvre)\
**Post date:** [April 29, 2014, 3:48pm UTC](https://forum.xojo.com/t/text-editor-example/16097/2 "2014-04-29T15:48:08Z")

</div>

Examples/Sample Projects/XojoText

Also see the related webinars:

[http://youtu.be/3JXWSIjideI](http://youtu.be/3JXWSIjideI)

[http://youtu.be/q4IpB59kCHs](http://youtu.be/q4IpB59kCHs)

---

<div class="post-metadata">

**Author:** ![Richard\_Summers](https://forum.xojo.com/user_avatar/forum.xojo.com/richard_summers/32/477_2.png) [@Richard\_Summers](https://forum.xojo.com/u/Richard_Summers)\
**Post date:** [April 29, 2014, 4:21pm UTC](https://forum.xojo.com/t/text-editor-example/16097/3 "2014-04-29T16:21:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Paul\_Lefebvre](https://forum.xojo.com/user_avatar/forum.xojo.com/paul_lefebvre/32/3152_2.png) [@Paul\_Lefebvre](https://forum.xojo.com/u/Paul_Lefebvre)\
**Post date:** [April 29, 2014, 4:29pm UTC](https://forum.xojo.com/t/text-editor-example/16097/4 "2014-04-29T16:29:13Z")

</div>

> [@83651:@Richard Summers](#):
>
> 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.

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”)  
#Else  
prefFolder = SpecialFolder.ApplicationData.Child(“XojoText”)  
#Endif

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)
  tis.Close
  
  FontName = prefs.Value("FontName")
  FontSize = prefs.Value("FontSize")
End If

```

End If[/code]

---

<div class="post-metadata">

**Author:** ![Richard\_Summers](https://forum.xojo.com/user_avatar/forum.xojo.com/richard_summers/32/477_2.png) [@Richard\_Summers](https://forum.xojo.com/u/Richard_Summers)\
**Post date:** [April 30, 2014, 3:55pm UTC](https://forum.xojo.com/t/text-editor-example/16097/5 "2014-04-30T15:55:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Axel\_Schneider](https://forum.xojo.com/user_avatar/forum.xojo.com/axel_schneider/32/465_2.png) [@Axel\_Schneider](https://forum.xojo.com/u/Axel_Schneider)\
**Post date:** [April 30, 2014, 5:12pm UTC](https://forum.xojo.com/t/text-editor-example/16097/6 "2014-04-30T17:12:24Z")

</div>

Example with TextColor Font and TextSize

[Example](http://www.axel-erfurt.de/apps/RTFModulTest.zip)

---

<div class="post-metadata">

**Author:** ![Richard\_Summers](https://forum.xojo.com/user_avatar/forum.xojo.com/richard_summers/32/477_2.png) [@Richard\_Summers](https://forum.xojo.com/u/Richard_Summers)\
**Post date:** [April 30, 2014, 5:25pm UTC](https://forum.xojo.com/t/text-editor-example/16097/7 "2014-04-30T17:25:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Richard\_Summers](https://forum.xojo.com/user_avatar/forum.xojo.com/richard_summers/32/477_2.png) [@Richard\_Summers](https://forum.xojo.com/u/Richard_Summers)\
**Post date:** [May 1, 2014, 12:38pm UTC](https://forum.xojo.com/t/text-editor-example/16097/8 "2014-05-01T12:38:59Z")

</div>

Really struggling with trying to create underline, bold, and italic toggle buttons ☹  
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?

---

<div class="post-metadata">

**Author:** ![Axel\_Schneider](https://forum.xojo.com/user_avatar/forum.xojo.com/axel_schneider/32/465_2.png) [@Axel\_Schneider](https://forum.xojo.com/u/Axel_Schneider)\
**Post date:** [May 1, 2014, 2:40pm UTC](https://forum.xojo.com/t/text-editor-example/16097/9 "2014-05-01T14:40:09Z")

</div>

in the Action Event of the button

TextArea1.SelUnderline = true

TextArea1.SelBold = true

TextArea1.SelItalic = true

---

<div class="post-metadata">

**Author:** ![Richard\_Summers](https://forum.xojo.com/user_avatar/forum.xojo.com/richard_summers/32/477_2.png) [@Richard\_Summers](https://forum.xojo.com/u/Richard_Summers)\
**Post date:** [May 1, 2014, 3:04pm UTC](https://forum.xojo.com/t/text-editor-example/16097/10 "2014-05-01T15:04:01Z")

</div>

Axel,  
Thanks.

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.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 5:12pm UTC](https://forum.xojo.com/t/text-editor-example/16097/11 "2020-10-29T17:12:09Z")

</div>


