Setting the cursor postion in TextArea

Post your Gambas programming questions here.
Post Reply
cage
Posts: 123
Joined: Monday 2nd September 2019 5:47am
Location: Phoenix Arizona

Setting the cursor postion in TextArea

Post 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..
cage
Posts: 123
Joined: Monday 2nd September 2019 5:47am
Location: Phoenix Arizona

Re: Setting the cursor postion in TextArea

Post 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.
User avatar
Quincunxian
Posts: 171
Joined: Sunday 25th June 2017 12:14am
Location: Western Australia

Re: Setting the cursor postion in TextArea

Post 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.
Cheers - Quin.
I code therefore I am
cage
Posts: 123
Joined: Monday 2nd September 2019 5:47am
Location: Phoenix Arizona

Re: Setting the cursor postion in TextArea

Post by cage »

Thanks Quin I will give that a try. ;)
Post Reply