Page 1 of 1

Setting the cursor postion in TextArea

Posted: Sunday 27th October 2019 9:24pm
by cage
I have been researching to find out how to set the cursor position to the beginning of a displayed text file loaded into a TextArea. I have no problem loading the file but the cursor is always at the end of the loaded file. What I want to do is have the text displayed at the beginning of the text. I have tried a few new commands but have had no results. Any help with this problem would be greatly appreciated..

Re: Setting the cursor postion in TextArea

Posted: Monday 28th October 2019 12:39am
by cage
Okay I figured it out. Found using the TextArea.Line command worked.

Example:
TextArea1.Line = 0
That will set the line back to the beginning of the text.

Re: Setting the cursor postion in TextArea

Posted: Tuesday 29th October 2019 12:05am
by Quincunxian
Hi Cage,
I had a play around with this as I was curious to see what it could do and found that
TextArea.Pos = 0 
may be a better solution.

I tried this; sort of expecting that the cursor would go to Pos 0 on the 2nd line :
TextArea1.Text = "alkdfashdfasufdyasiudfhaskdjfhaskjdlfha" & Gb.CrLf & "ALKJDHFLKAJSHDFKJASHDFKAJLSHDFAJKSDHF"
TextArea1.Line = 1
It ended up on the second last character of the second line so I'm not really sure what it's doing?
As per the Gambas wiki - it may have something to do with the UTF-8 warning on byte counts ect.

Re: Setting the cursor postion in TextArea

Posted: Tuesday 29th October 2019 3:08am
by cage
Thanks Quin I will give that a try. ;)