Ask Your Question
0

base form multi-line text box auto scroll?

asked 2016-07-28 05:20:32 +0200

jvglynnjr gravatar image

updated 2016-07-29 11:46:02 +0200

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?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2017-03-19 00:04:11 +0200

librebel gravatar image

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
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-07-28 05:20:32 +0200

Seen: 222 times

Last updated: Mar 19 '17