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

Re: Scrolling/keeping textArea down


On 9/23/25 9:13 AM, Admin wrote:
Also, continuing this chat-style-program discussion, with your help I understood the sending request from a textfield using Enter key, and now I wonder if there's a way to keep textArea scrolled down. Kinda obvious question maybe. But if my chat log is in [read-only] textArea, the text adds and adds and soon I need to scroll the textArea down to be able to read it. I did what seemed obvious to me after text is added to a Response textArea:


Response.Pos = MaximResponse.Length
Response.EnsureVisible()


But that does not work the way I want it to, and I googled a lot and found out why. With all this differences in QT and GTK I can understand why, but still...

Isn't there a way to just simply scroll an element that has scrollbars? I mean by the code, not mouse. I guess not, because it is not in those toolkits, right? I kinda wonder why not?


Dmitry.

The .EnsureVisible() method should be the solution you need. However, its effectiveness may depend on how the TextArea is being filled.

If it the text is being added by one or more event handlers, the .EnsureVisible() method may not have an opportunity to refresh the TextArea's display. You may need to do something like:

[code]
Response.EnsureVisible
Response.Refresh
Wait 0
[/code]

How is the text being added to the TextArea?


--
Lee

--- Gambas User List Netiquette [https://gambaswiki.org/wiki/doc/netiquette] ----
--- Gambas User List Archive [https://lists.gambas-basic.org/archive/user] ----


References:
Scrolling/keeping textArea downAdmin <admin@xxxxxxxxxx>