scrollPosition([x], [y])

Class: InternalWindowContainer. Method inherited from UIComponent.

Description:

Sets and gets horizontal (X) and vertical (y) scroll positions. Applies only to components that have scroll bars, such as TextField, List, Table, DocumentEditor, Tree, ScrollPane, and InternalWindowContainer.

Parameters:

Name Type Default Description

[x]

number

null

Set integer number to set horizontal position or null to omit. Omit this argument to get scroll position.

[y]

number

null

Set integer number to set vertical position or null to omit.

Returns:

Returns horizontal and vertical scroll positions as an Object{x:number, y:number} if no arguments are passed, otherwise returns this component instance.

Type: this | Object

Examples:

const position = textarea.scrollPosition(); // Gets horizontal and vertical scroll positions as an Object{x:number, y:number}
textarea.scrollPosition(40, 20); // sets horizontal and vertical scroll positions
textarea.scrollPosition(null, 20); // sets only vertical scroll position
textarea.scrollPosition(40, null); // sets only horizontal scroll position
textarea.scrollPosition(40); // sets only horizontal scroll position