Multi line text areas
Posted
#1
(In Topic #642)
Trainee
Below is where I am at and the issue is with the inputext replaces the information in the box and not appends the text. So what am I doing wrong?
Code
Dim inputext As String = ""
TextBox1.Text = "Hello World " 'Works as expected
TextArea1.Text = "Line 1" & Chr(10) & "Line 2" 'Works as expected
'Message("Click ok")
inputext = InputBox("Type something")
TextArea1.Text = Chr(10) & inputext ' Want this to be line 3 but it replaces text
Posted
Regular

GBowlsby said
I am new to GAMBAS. I have VB.net experience. What I am trying to do is append text to my textarea. In VB.net I would use textbox.appendtext("Line" & vbcrlf)
…Below is where I am at and the issue is with the inputext replaces the information in the box and not appends the text. So what am I doing wrong?…
Welcome to GambasOne
You just need to add the new text at the end:-
…or:-
Code (gambas)
I hope this helps.
Posted
Trainee
Posted
Guru

using Insert() does a cleaner appending
Code (gambas)
- TextArea1.Insert(gb.Lf & inputext) ' Want this to be line 3...
Posted
Trainee
Posted
Regular

BruceSteers said
if there is a lot of text textarea can be glitchy using "Text = Text &" or "&=" as it refreshes the whole text…
That's interesting Bruce, what does this glitch look like?
I have never seen a problem.
Posted
Guru

stevedee said
BruceSteers said
if there is a lot of text textarea can be glitchy using "Text = Text &" or "&=" as it refreshes the whole text…
That's interesting Bruce, what does this glitch look like?
I have never seen a problem.
it does odd things to the scroll bar as the objects text gets a complete re-write. the glitches are not so noticable on speedy machines.
I moaned about the odd behaviour on the m/l and Benoit gave me the advice on using Insert()
I made a quick clip..
In the clip the textarea on the top has Text &= "Hello" , the lower one uses Insert()
you can see the scrollbar oddness in the top textarea as i click to add text. (just about)
Like i say more noticable on slower machines and if textarea has lots and lots of text to rewrite.
<VIDEO content="http://138.68.116.47/screenrecord-2021-04-25_13.16.08.webm">[video]
1 guest and 0 members have just viewed this.


