Setting the cursor postion in TextArea

Post

Posted
Rating:
#1 (In Topic #332)
Avatar
Regular
cage is in the usergroup ‘Regular’
 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..
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Regular
cage is in the usergroup ‘Regular’
Okay I figured it out.  Found using the TextArea.Line command worked.

Example:

Code (gambas)

  1. TextArea1.Line = 0

That will set the line back to the beginning of the text.
Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Expert
Quincunxian is in the usergroup ‘Expert’
Hi Cage,
I had a play around with this as I was curious to see what it could do and found that

Code (gambas)

  1. 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 :

Code (gambas)

  1. TextArea1.Text = "alkdfashdfasufdyasiudfhaskdjfhaskjdlfha" & Gb.CrLf & "ALKJDHFLKAJSHDFKJASHDFKAJLSHDFAJKSDHF"
  2. TextArea1.Line = 1
  3.  
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
Online now: No Back to the top

Post

Posted
Rating:
#4
Avatar
Regular
cage is in the usergroup ‘Regular’
Thanks Quin I will give that a try.   ;)
Online now: No Back to the top
1 guest and 0 members have just viewed this.