object:scrollTo()

Type Function
Library widget.*
Revision Release 2022.3683
Keywords widget, scroll view, ScrollViewWidget, scrollTo
See also object:scrollToPosition()
widget.newScrollView()
ScrollViewWidget

Overview

Makes a ScrollViewWidget scroll to a specified position constant.

Syntax

object:scrollTo( position, options )
position (required)

String. This is the position you wish to scroll to. Valid options are "top", "bottom", "left", or "right".

options (required)

Table. A table that specifies properties of the call — see the next section for details.

Parameter Reference

time (optional)

Number. Time in milliseconds to scroll to the specified position. For an instantaneous effect (no transition), set this to 0. Default is 400.

onComplete (optional)

Function. An optional function that will be called when the scroll completes.

Example

local function onScrollComplete()
    print( "Scroll complete!" )
end

scrollView:scrollTo( "bottom", { time=1200, onComplete=onScrollComplete } )