guiGridListSetHorizontalScrollPosition | Multi Theft Auto: Wiki Skip to content

guiGridListSetHorizontalScrollPosition

Client-side
Server-side
Shared

Pair: guiGridListGetHorizontalScrollPosition

This function is used to set the horizontal scroll position of a grid list.

OOP Syntax Help! I don't understand this!

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

Syntax

bool guiGridListSetHorizontalScrollPosition ( ​gui-gridlist guiGridlist, ​float fPosition )
Required arguments
  • guiGridlist: The grid list you want to set the horizontal scroll position for.
  • fPosition: A float representing the horizontal scroll position (0-100).

Returns

Returns true if the horizontal scroll position was set, or false otherwise.

  • bool: result

Code Examples

client

This example sets the position of the horizontal scroll and outputs it to the chatbox.

local gridList = guiCreateGridList(0.80, 0.10, 0.15, 0.60, true) -- Create the grid list
for i = 1,4 do
guiGridListAddColumn(gridList, "Column "..tostring(i), 0.8) -- Create a new column in the grid list
end
for i = 1,30 do
local text = "Item "..tostring(i)
guiGridListAddRow(gridList, "#1 "..text, "#2 "..text, "#3 "..text, "#4 "..text)
end
if gridList then -- if the grid list exist then
guiGridListSetHorizontalScrollPosition(gridList, 50) -- in the middle
local postion = guiGridListGetHorizontalScrollPosition(gridList) -- get the horizontal scroll position
outputChatBox("Current position of the horizontal scroll: " .. tostring(position) .. "%") -- output to the chatbox
else
outputChatBox("Grid list not found!") -- if the grid list was not found
end

See Also

GUI Functions