Code: Select all
Public Sub Form_Open()
Dim i As Integer
Dim s As String = Null
For i = 0 To 9
If s Then
s &= gb.NewLine & i & ". This is line " & i
Else
s = i & ". This is line " & i
Endif
Next
TextArea1.Text = s
End
Public Sub TextArea1_MouseUp()
Dim iLin, iCol, iFirst As Integer
Dim sText As String
iLin = TextArea1.Line
iCol = TextArea1.Column
iFirst = TextArea1.ToPos(iLin, 0)
sText = "Current cursor position = " & TextArea1.Pos
sText &= gb.NewLine & "Current line = " & iLin & "; Current column = " & iCol
sText &= gb.NewLine & "Position at start of line " & iLin & " = " & iFirst
sText &= gb.NewLine & TextArea1.Select(iFirst, 1) ''####### THIS IS THE PROBLEM LINE
TextArea2.Text = sText
End
According to the Gambas wiki, Textarea.Select should select the text with a start and length range:
TextArea.Select (gb.qt4)
Sub Select ( [ Start As Integer, Length As Integer ] )
Define the selected text.
Start is the position of the first selected character in the text.
Length is the length of the selection.
If no argument is specified, the entire text is selected.
So what am I missing or doing wrong?
bazzvn