TomA Active Member Licensed User Longtime User Sep 4, 2014 #1 I have been trying to find a way to scroll text automatically so info appended to the end is always shown without the user having to intervene so that when a line is added, the text scrolls to show it (think computer terminal). Can someone tell me how this might be done?
I have been trying to find a way to scroll text automatically so info appended to the end is always shown without the user having to intervene so that when a line is added, the text scrolls to show it (think computer terminal). Can someone tell me how this might be done?
Erel B4X founder Staff member Licensed User Longtime User Sep 4, 2014 #3 Method that adds text to a TextArea and scrolls it: Code: Copy Sub lg(msg As String) txtLogs.Text = txtLogs.Text & CRLF & msg txtLogs.SetSelection(txtLogs.Text.Length, txtLogs.Text.Length) End Sub Upvote 0
Method that adds text to a TextArea and scrolls it: Code: Copy Sub lg(msg As String) txtLogs.Text = txtLogs.Text & CRLF & msg txtLogs.SetSelection(txtLogs.Text.Length, txtLogs.Text.Length) End Sub
TomA Active Member Licensed User Longtime User Sep 4, 2014 #4 Thanks Erel - works perfectly! Upvote 0
wonder Expert Licensed User Longtime User Nov 4, 2015 #5 Code: Copy txtStatsBox.Text = txtStatsBox.Text & CRLF & ">> Status: Ready." & CRLF txtStatsBox.SetSelection(txtStatsBox.Text.Length, txtStatsBox.Text.Length) This doesn't work for me... Even with Request Focus. Any solution? Upvote 0
Code: Copy txtStatsBox.Text = txtStatsBox.Text & CRLF & ">> Status: Ready." & CRLF txtStatsBox.SetSelection(txtStatsBox.Text.Length, txtStatsBox.Text.Length) This doesn't work for me... Even with Request Focus. Any solution?
saunwin Active Member Licensed User Longtime User Jan 7, 2016 #6 Ummm .. funny Not working for me either Sub lg(msg As String) monitor.Text = monitor.Text & CRLF & msg monitor.SetSelection(monitor.Text.Length, monitor.Text.Length) End Sub Do you get to the bottom of this ? Upvote 0
Ummm .. funny Not working for me either Sub lg(msg As String) monitor.Text = monitor.Text & CRLF & msg monitor.SetSelection(monitor.Text.Length, monitor.Text.Length) End Sub Do you get to the bottom of this ?
saunwin Active Member Licensed User Longtime User Jan 7, 2016 #7 Got it working now. I think it's because I was also writing to the text area from outside this subroutine. Do all text area writes using the subroutine works. Upvote 0
Got it working now. I think it's because I was also writing to the text area from outside this subroutine. Do all text area writes using the subroutine works.
jmon Well-Known Member Licensed User Longtime User Jan 7, 2016 #8 You can also use the scrolltop method with Javaobject https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/TextArea.html#scrollTopProperty so that way no need to chnage the caret position Upvote 0
You can also use the scrolltop method with Javaobject https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/TextArea.html#scrollTopProperty so that way no need to chnage the caret position