# How to avoid blank textarea after scrolling?

**URL:** <https://forum.xojo.com/t/how-to-avoid-blank-textarea-after-scrolling/53593>\
**Category:** Getting Started\
**Created:** [May 1, 2020, 2:31pm UTC](https://forum.xojo.com/t/how-to-avoid-blank-textarea-after-scrolling/53593 "2020-05-01T14:31:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Farai\_Aschwanden](https://forum.xojo.com/letter_avatar_proxy/v4/letter/f/e79b87/32.png) [@Farai\_Aschwanden](https://forum.xojo.com/u/Farai_Aschwanden)\
**Post date:** [May 1, 2020, 2:31pm UTC](https://forum.xojo.com/t/how-to-avoid-blank-textarea-after-scrolling/53593/1 "2020-05-01T14:31:11Z")

</div>

Hello

I’m having troubles with scrolling down in textareas. It works fine on Mac but not on Windows (10) and Linux (Ubuntu 18.x) . Imagine a textconsole where the user can send a command (textitem) and the result is appended to the textarea. Then (after adding text) I scroll down most bottom. As soon as the text overlaps the vertical size of the textarea very often the textarea stays blank. If I then click on the scrollbar (not even moving it) the text will be displayed. Mouseclick into textarea or resizing the main window does not help.

I have tried these three commands, all did not solve the problem:

[code]MyTextarea.VerticalScrollPosition = MyTextarea.Value.Length

MyTextarea.SelectionStart = MyTextarea.Value.Length

MyTextarea.ScrollPosition = MyTextarea.LineNumAtCharPos(len(MyTextarea.Text))[/code]

Is this not enough? Did I miss anything?

---

<div class="post-metadata">

**Author:** ![Farai\_Aschwanden](https://forum.xojo.com/letter_avatar_proxy/v4/letter/f/e79b87/32.png) [@Farai\_Aschwanden](https://forum.xojo.com/u/Farai_Aschwanden)\
**Post date:** [May 1, 2020, 3:22pm UTC](https://forum.xojo.com/t/how-to-avoid-blank-textarea-after-scrolling/53593/2 "2020-05-01T15:22:26Z")

</div>

I had some scroll commands in other areas. After disabling those I have now more proper test results about textarea scrolling:

Not Working on Windows, Linux : causing empty looking textarea :

```auto
MyTextarea.VerticalScrollPosition = MyTextarea.Value.Length
```

Not working on Linux: keeps hanging sometimes, not moving to the bottom end :

```auto
MyTextarea.SelectionStart = MyTextarea.Value.Length
```

Not working on Windows (empty looking textarea) and Linux (sometimes, not moving to the bottom end) :

```auto
MyTextarea.ScrollPosition = MyTextarea.LineNumAtCharPos(len(MyTextarea.Text))
```

Conclusion: None of these 3 command work on all 3 OSs, none can make it work on Linux.

---

<div class="post-metadata">

**Author:** ![MarkusR](https://forum.xojo.com/user_avatar/forum.xojo.com/markusr/32/685_2.png) [@MarkusR](https://forum.xojo.com/u/MarkusR)\
**Post date:** [May 2, 2020, 5:33am UTC](https://forum.xojo.com/t/how-to-avoid-blank-textarea-after-scrolling/53593/3 "2020-05-02T05:33:12Z")

</div>

it seems this show only the last row at top of the textarea

`Function KeyDown(Key As String) Handles KeyDown as Boolean
  If key = Chr(13) Then
    TextArea1.Value = TextArea1.Value + TextField1.Value + EndOfLine
    TextArea1.VerticalScrollPosition = TextArea1.LineNumber(TextArea1.Value.Length)
  End If
End Function
`

but you can subtract some rows to see more than just one  
as example -5

`If key = Chr(13) Then
  TextArea1.Value = TextArea1.Value + TextField1.Value + EndOfLine
  TextArea1.VerticalScrollPosition = TextArea1.LineNumber(TextArea1.Value.Length) -5
End If`

---

<div class="post-metadata">

**Author:** ![Farai\_Aschwanden](https://forum.xojo.com/letter_avatar_proxy/v4/letter/f/e79b87/32.png) [@Farai\_Aschwanden](https://forum.xojo.com/u/Farai_Aschwanden)\
**Post date:** [May 2, 2020, 3:34pm UTC](https://forum.xojo.com/t/how-to-avoid-blank-textarea-after-scrolling/53593/4 "2020-05-02T15:34:14Z")

</div>

@Markus Rauch Tnx for the input. Sadly I can’t confirm… After scrolling and when the view of textarea disappears I know it was scrolling to the very bottom. This can be proven by just clicking the scrollbar of the textarea (just click on it, don’t move it). All the bottom text of the textarea appears. This seems to be a refreshing problem after scrolling.

---

<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:** [April 29, 2021, 4:23pm UTC](https://forum.xojo.com/t/how-to-avoid-blank-textarea-after-scrolling/53593/5 "2021-04-29T16:23:21Z")

</div>


