API:ScrollWindowSetOffset
From RoR Wiki
UI Lua API · ScrollWindow functions
Version: WAR 1.4.8
Scrolls a ScrollWindow to a vertical offset.
ScrollWindowSetOffset(scrollWindowName, offset)
Arguments
- scrollWindowName
string– Name of the ScrollWindow.- offset
number– Distance in pixels from the top of the content to the top of the visible area.
Returns
Nothing.
Details
- The offset is clamped to the range from 0 to the content height minus the window height. If the content is not taller than the window, the offset is always 0.
- The content height is the one the ScrollWindow last measured; ScrollWindowUpdateScrollRect measures it again. Call that first if the content has changed.
- If the clamped offset is the same as the current one, nothing happens.
- Otherwise the scroll child is moved and the ScrollWindow's scroll bar, if it has one, is moved to the same position.
- The function needs at least two arguments and only reads the last two. Any extra arguments placed in front of them are ignored.
Errors
Error in function call 'ScrollWindowSetOffset': Window %s does not existError in function call 'ScrollWindowSetOffset': Window %s is not a ScrollWindow
Example
From default/ea_chatwindow/source/chathyperlinking.lua:
-- Update the scroll window ScrollWindowSetOffset( windowName.."Info", 0 ) ScrollWindowUpdateScrollRect( windowName.."Info" )
