OnDgsElementScroll: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Client event}} __NOTOC__ This event is fired when a DGS element is scrolled ( including scroll bar and scroll bars of scroll pane, grid list, memo and combo box ). ==Param...")
 
No edit summary
 
(One intermediate revision by one other user not shown)
Line 5: Line 5:
==Parameters==  
==Parameters==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
element Scrolled
element ScrollBar, float ScrollTo, float ScrollFrom
</syntaxhighlight>
</syntaxhighlight>
* '''ScrollBar''': The scroll bar that has changed its scroll position.
* '''ScrollBar''': The scroll bar that has changed its scroll position.
Line 21: Line 21:
outputChatBox("The new scroll position is "..new.." ( was:"..old.." )")
outputChatBox("The new scroll position is "..new.." ( was:"..old.." )")
end
end
addEventHandler("onDgsElementScroll",getRootElement(),OnScroll)
addEventHandler("onDgsElementScroll",root,OnScroll)
</syntaxhighlight>
</syntaxhighlight>



Latest revision as of 09:19, 4 November 2020

This event is fired when a DGS element is scrolled ( including scroll bar and scroll bars of scroll pane, grid list, memo and combo box ).

Parameters

element ScrollBar, float ScrollTo, float ScrollFrom
  • ScrollBar: The scroll bar that has changed its scroll position.
  • ScrollTo: The value of current scroll position
  • ScrollFrom: The value of previous scroll position

Source

The source of this event is the dgs element that got scrolled (can be scroll pane, grid list, combo box, memo and scroll bar).

Example

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

DGS = exports.dgs
function OnScroll(scb,new,old)
	outputChatBox("The new scroll position is "..new.." ( was:"..old.." )")
end
addEventHandler("onDgsElementScroll",root,OnScroll)

See Also

DGS events

General

Check Box

Combo Box

Drag'N Drop

Edit

Grid List

Menu

Selector

Mouse

Radio Button

Switch Button

Tab

Animation

Plugin

Media

Color Picker

QRCode

Remote Image

Client event functions