OnClientGUIScroll: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Replace to predefined variables.)
 
Line 15: Line 15:
This example outputs a message with the new scroll position when a scrollbar is scrolled.
This example outputs a message with the new scroll position when a scrollbar is scrolled.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function OnScroll(Scrolled)
function onClientGUIScroll(scrollBar)
outputChatBox("The new scroll position is "..guiScrollBarGetScrollPosition(Scrolled))
outputChatBox("The new scroll position is "..guiScrollBarGetScrollPosition(scrollBar))
end
end
addEventHandler("onClientGUIScroll",getRootElement(),OnScroll)
addEventHandler("onClientGUIScroll", root, onClientGUIScroll)
</syntaxhighlight>
</syntaxhighlight>



Latest revision as of 07:11, 13 July 2023

This event is fired when a GUI scrollbar is scrolled.

Parameters

element scrolled
  • scrolled: the scrollbar element that was scrolled.

Source

The source of this event is the scrollbar element that got scrolled.

Example

This example outputs a message with the new scroll position when a scrollbar is scrolled.

function onClientGUIScroll(scrollBar)
	outputChatBox("The new scroll position is "..guiScrollBarGetScrollPosition(scrollBar))
end
addEventHandler("onClientGUIScroll", root, onClientGUIScroll)

See Also

Input

GUI


Client event functions