I have a text box that displays a cumulative output with a new line at the end of each item. It has a vertical scroll bar. How do I get the box to autoscroll down to the bottom as the visible part fills up, the way a terminal window would?
hello jvg, you could write this macro in StarBasic and connect it to the “Text modified” event of your text box:
Sub Multiline_ScrollDown( oEvent )
REM Connect this method to the "Text modified" event of a Multiline Textbox.
REM This moves the caret position to the end of the text, each time the text changes.
Dim oSelection, iEndPos as Integer
iEndPos = Len( oEvent.Source.Text )
oSelection = createUnoStruct( "com.sun.star.awt.Selection" )
oSelection.Min = iEndPos
oSelection.Max = iEndPos
oEvent.Source.setSelection( oSelection )
End Sub