B4J Question TextArea move cursor to end when loading text

Nokia

Active Member
Licensed User
how to I move cursor/caret to the end of the textarea on new line?

If it's a lot of text will the auto scroll down as well?
 

Nokia

Active Member
Licensed User
This moves the cursor at the end of the text:
B4X:
TextArea1.SetSelection(TextArea1.Text.Length, TextArea1.Text.Length)

didn't seem to work... the only difference is that the cursor did not show at all.. and the scroll bar was up and not down to the end of text..
any other ideas?
 

Nokia

Active Member
Licensed User
didn't seem to work... the only difference is that the cursor did not show at all.. and the scroll bar was up and not down to the end of text..
any other ideas?
sorry my mistake.. it did have cursor at bottom, I just could not see it because the scroll bar was not down.. it didn't move at all..

Is there a way to put scroll bar in the down position?
 

klaus

Expert
Licensed User
What exactly doesn't work?
I tested it before posting my answer!
This is what I get without TextArea1.SetSelection(TextArea1.Text.Length, TextArea1.Text.Length)
1582153550314.png

and this is with TextArea1.SetSelection(TextArea1.Text.Length, TextArea1.Text.Length)
1582153817924.png

That's what I get in my tests, te cursor is at the end and the scrollbar is down!
So where and what is your problem?
 

Nokia

Active Member
Licensed User
What exactly doesn't work?
I tested it before posting my answer!
This is what I get without TextArea1.SetSelection(TextArea1.Text.Length, TextArea1.Text.Length)
View attachment 88898
and this is with TextArea1.SetSelection(TextArea1.Text.Length, TextArea1.Text.Length)
View attachment 88901
That's what I get in my tests, te cursor is at the end and the scrollbar is down!
So where and what is your problem?
the cursor does show at the end.. but it does not scroll down to the bottom like yours show..
I am filling the textarea through a string value.. not typing it in..
 

Nokia

Active Member
Licensed User
You need to show us what you have done.
Without seeing any code it's impossible to give a concrete advice.
Post a small project showing the problem.

so I made a simple test app and it worked like you said.. but still did not work on my hap.. so I change the form.show to the end of the load sub and it shows at bottom and scroll bar is at the bottom like in your app above.

so now it looks right..
 
Top