Text output with scrollbar...?

TWELVE

Active Member
Licensed User
Hello,

i'm trying to output text to a certain area of my app.The control where the text appears should have a scrollbar to scroll within the output.The text output is intended as a log console.

Currently i'm using a multiline textbox control, which is perfect at the first look.Unfortunately the behavior of this control is not exactly the way i want it to have.Instead of showing the last lines of text it is always showing the first lines.Even if i scroll to the end of the text, it jumps back to the beginning of the text as soon the text content gets updated by the app.

So, how can i make the textbox showing me always the bottom lines...? Can i place the cursor at the end of the text..?

I know, the textbox is mainly for text input, but i did not find any other control that could do this job.Eventually the listbox, but this control is also intended as a input rather than to be a output.




regards

TWELVE
 

klaus

Expert
Licensed User
You should use the following code.
B4X:
  TextBox1.SelectionStart=StrLength(TextBox1.Text)
  TextBox1.ScrollToCaret
  TextBox1.Focus
SelectionStart sets the cursor position, can be any position inbetween 0 and StrLengthStrLength(TextBox1.Text)
ScrollToCaret shows the cursor position
Focus set the focus on the TextBox

Best regards
 
Last edited:

TWELVE

Active Member
Licensed User
Thanks very much for the reply,

i found the exact same solution meanwhile by my own..:)
Except for one line, i do not use the .Focus.Is not necessary because i don't need to type
in something.


kind regards

TWELVE
 
Top