Copy lines from TextArea
Posted
#1
(In Topic #851)
Trainee
I want to copy some lines from one TextArea and paste into another.
In the old version of Gambas I used the commands below. But now they don't work anymore.
Code (gambas)
- TextArea1.Insert(gb.NewLine & TextArea2.Lines[6].text & gb.NewLine & TextArea2.Lines[7].text & gb.NewLine & TextArea2.Lines[8].text)
Does anyone know how I do this now?
Posted
Expert

TextArea.Pos will set or return the current cursor position.
I'm using MINT 20 with QT and the above example works for me.
Cheers - Quin.
I code therefore I am
I code therefore I am
Posted
Guru

kitoeag said
Hello everybody.
I want to copy some lines from one TextArea and paste into another.
In the old version of Gambas I used the commands below. But now they don't work anymore.Code (gambas)
TextArea1.Insert(gb.NewLine & TextArea2.Lines[6].text & gb.NewLine & TextArea2.Lines[7].text & gb.NewLine & TextArea2.Lines[8].text)
Does anyone know how I do this now?
There's a few ways…
I'd use Split and Extract to get the 3 required lines..
Code (gambas)
Or you could make a Line Function..
Line(TextArea2.Text, 6)
Or as you are getting lines 6, 7, and 8 you could join the 2 above methods to be a function called Lines() that will get more than one line joined with LF's…
TextArea1.Insert(gb.NewLine & Lines(TextArea2.Text, 6, 3))
Or you could use an array of indexes in case the required lines were not all together…
TextArea1.Insert(gb.NewLine & Lines(TextArea2.Text, [6, 7,10]))
1 guest and 0 members have just viewed this.


