API:ScrollWindowGetOffset
From RoR Wiki
UI Lua API · ScrollWindow functions
Version: WAR 1.4.8
Returns the vertical scroll offset of a ScrollWindow.
offset = ScrollWindowGetOffset(scrollWindowName)
Arguments
- scrollWindowName
string– Name of the ScrollWindow.
Returns
- offset
number– Distance in pixels from the top of the content to the top of the visible area.
Details
- The stock UI never calls this function.
Errors
Error in function call 'ScrollWindowGetOffset': Window %s does not existError in function call 'ScrollWindowGetOffset': Window %s is not a ScrollWindow
Example
Keeping the scroll position while the content is rebuilt, built from the documented signatures:
local offset = ScrollWindowGetOffset( "MyScrollWindow" ) -- ... rebuild the content ... ScrollWindowUpdateScrollRect( "MyScrollWindow" ) ScrollWindowSetOffset( "MyScrollWindow", offset )
