[Gambas-user] TextArea scrolling

Benoît Minisini gambas at ...1...
Mon May 25 21:37:46 CEST 2009


> >> When adding line to textarea:
> >> TextArea1.Text &= "Something" & gb.NewLine
> >> Cursor jumps to column&line zero.
> >
> > Normal, you are assigning the Text property. Use the Insert() method
> > instead.
>
>  Ok... I did it vb6 way...
>  But there is still problem. Mouse click on the textarea mess up the
> cursor position,
>  and next insert ruins output. Even if ReadOnly property is True.
>
>  And also I use Mid$() to edit content of the textarea.
>  Like this;
>  Mid$(.Text, (Len(.Text) - iLastMessageLen), Len(.Text)) = (sTellMe &
> gb.NewLine)
>  It is meant to correct the output afterwards if needed.
>  But maybe there is other way to erase last message and replace it
> with new one... this is
>  quickly converted from vb6 code.
>
>  Is there way to determine cursors last column and last line?
>  At this point I'm not sure how to do this...
>
>
> Jussi
>

Use The Pos property to set the position of the cursor. To solve your problem, 
just set the cursor to the end of the text before calling Insert:

MyTextArea.Pos = MyTextArea.Length
MyTextArea.Insert("text")

Moreover, you must use UTF-8 String methods to deal with the contents of any 
GUI Text property.

I suggest you read the documentation of the TextArea widget carefully!

Regards,

-- 
Benoît




More information about the User mailing list