I can find the last line in a TextArea with code like
Dim lastLine As Integer = TextArea1.LineNumAtCharPos(TextArea1.Text.Len)
But I can’t successfully compare that against ScrollPosition because that value changes depending upon the height the window and the size of the elevator within the scrollbar.
Any ideas to determine if a TextArea has been scrolled to the bottom? I’m using this for a simple log window that auto scrolls unless you’ve scrolled up.
Sub Log(msg as string)
textArea1.append msg + EndOfLine
if checkboxAutoScroll.value = true then
textArea1.ScrollPostion = 9999999
end if
which works great, but requires the user to click the checkbox.
I wonder if one could do this:
if (me.actualScrollPositon < textArea1.ScrollPostion) then
' user has manually scrolled - append message but don't scroll
textArea1.append msg + EndOfLine
else
' user has not scrolled, append text and scroll to bottom
textArea1.append msg + EndOfLine
textArea1.ScrollPostion = 9999999
me.actualScrollPositon = textArea1.ScrollPostion
end if