guiScrollPaneSetHorizontalScrollPosition | Multi Theft Auto: Wiki Skip to content

guiScrollPaneSetHorizontalScrollPosition

Client-side
Server-side
Shared

Pair: guiScrollPaneGetHorizontalScrollPosition

This function is used to set the position of a horizontal scroll pane as a percentage.

OOP Syntax Help! I don't understand this!

  • Method:gui-scrollpane:setHorizontalScrollPosition(...)
  • Variable: .horizontalScrollPosition

Syntax

bool guiScrollPaneSetHorizontalScrollPosition ( ​gui-scrollpane horizontalScrollPane, ​float position )
Required arguments
  • horizontalScrollPane: The scroll pane you want to change the position of.
  • position: A float ranging from 0 - 100.

Returns

Returns true if the position was set, false otherwise.

  • bool: result

Code Examples

client
local scrollpane = guiCreateScrollPane(0.3, 0.3, 0.2, 0.2, true)
for i = 1,10 do
guiCreateButton(0.1 + 0.25 * i, 0.4, 0.2, 0.2, 'Button '..i, true, scrollpane)
end
addCommandHandler('scroll', function(cmd, value)
if (not tonumber(value)) then
return
end
guiScrollPaneSetHorizontalScrollPosition(scrollpane, tonumber(value))
end)

See Also

GUI Functions