[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scrolling/keeping textArea down


Maybe use insert (it's faster)..

Response.Insert(s) ' cursor should be at end so no need to set Pos
Response.EnsureVisible

Respects
BruceS


On Tue, 23 Sept 2025, 15:48 Lee, <t.lee.davidson@xxxxxxxxx> wrote:

> On 9/23/25 10:31 AM, Admin wrote:
> >
> [snip]>>>
> >>> Response.Pos = MaximResponse.Length
> >>> Response.EnsureVisible()
> >>>
> [snip]>>
> >> How is the text being added to the TextArea?
> >>
> >>
> > Well, to be precise, there's httpClient receiving JSON request through
> sBuffer = Read #hClient, Lof(hClient), after that it
> > JSON.decodes sBuffer into a string variable, and finally the
> Response.Text &='s with this variable. Then there's Wait 0.1, so
> > that all the interface is completely redrawn and we forget about
> everything that was before that. Only then I do Pos =
> > Response.Lenght, then EnsureVisible and already tried Refresh and Wait 0
> after that. Same result: the scrollbar appears
> > somewhere is the middle of the textArea.
> >
> >
> > So basically I would say, as far as I understand how Wait works, that
> direct answer to your question is: the text is already there.
>
> Well, no, it is not "already there". It is being added with the &=
> operator from the results of reading the HttpClient stream.
> But you did not say what triggers that Read. Is it accomplished in the
> HttpClient_Read event?
>
> Above you showed that you were setting Response.Pos with the value of
> MaximResponse.Length. Just now you said you set .Pos from
> Response.Length. If what you said first is accurate, perhaps
> MaximResponse.Length does not contain a value appropriate to use
> for Response.Pos.
>
> Or, it may simply be that the TextArea.Length property does not contain a
> value appropriate to use for TextArea.Pos.
> https://gambaswiki.org/wiki/comp/gb.qt4/textarea/pos :
> "As the text is stored in UTF-8, you must use the String class to convert
> this position to the byte index in the string."
>
> (I do not know of TextArea.Length takes UTF-8 characters into account.
> Anyone?)
>
> Have you tried NOT setting Response.Pos and simply let the TextArea's text
> addition process handle that itself?
>
>
> --
> Lee
>
> --- Gambas User List Netiquette [
> https://gambaswiki.org/wiki/doc/netiquette] ----
> --- Gambas User List Archive [https://lists.gambas-basic.org/archive/user]
> ----
>
>
>

Follow-Ups:
Re: Scrolling/keeping textArea downgbWilly <gbWilly@xxxxxxxxxxxxxx>
Re: Scrolling/keeping textArea downAdmin <admin@xxxxxxxxxx>
References:
Scrolling/keeping textArea downAdmin <admin@xxxxxxxxxx>
Re: Scrolling/keeping textArea downLee <t.lee.davidson@xxxxxxxxx>