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

Re: Scrolling/keeping textArea down


On 9/24/25 9:39 AM, Lee wrote:
On 9/24/25 8:17 AM, Gianluigi wrote:
OK, the example was too simple, this new one that I attach, here works with both gtk and qt.

Unfortunately, it does not work correctly here with GTK3.

I don't have an issue with the Enter key adding text twice, so I commented out TextBox1.Clear for my convenience. The relevant code for reference:
[code]
Public Sub Button1_Click()

   TextArea1.Text &= "\n\n" & TextBox1.Text
   ' TextBox1.Clear
   Wait 0.3
   TextArea1.EnsureVisible

End
[/code]

Interestingly, it does work as expected in some instances (described below) with Wait 0.3, Wait 0.1, and Wait. But, with Wait 0, the behavior of the scroll bar is immediately random.

If the mouse cursor remains over the TextArea (control) and the Enter key is used to add text, it works as expected.

But, if the mouse has entered the control and then leaves the control to click Button1, the newly added text is not displayed until the mouse re-enters the control. There is one exception to this.

If when the mouse has entered the control, the scroll bar is scrolled by dragging it and then the mouse leaves the control to click Button1, it works as expected.


It is a weird bug indeed.

I think I have found a workaround:
[code]
Public Sub Button1_Click()

  TextArea1.Text &= "\n\n" & TextBox1.Text
  ' TextBox1.Clear
  Wait ' or Wait 0.1
  TextArea1.SetFocus ' <--- THIS
  TextArea1.EnsureVisible

End
[/code]


--
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 downGianluigi <gradobag@xxxxxxxxxxx>
References:
Scrolling/keeping textArea downBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: Scrolling/keeping textArea downBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: Scrolling/keeping textArea downGianluigi <gradobag@xxxxxxxxxxx>
Re: Scrolling/keeping textArea downLee <t.lee.davidson@xxxxxxxxx>