OnClientMouseWheel: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(4 intermediate revisions by 4 users not shown) | |||
Line 7: | Line 7: | ||
int upOrDown | int upOrDown | ||
</syntaxhighlight> | </syntaxhighlight> | ||
* '''upOrDown''': An integer representing whether the scroll was scrolled up or down. This can be either '''1''' (mouse was scrolled up) or '''-1''' (mouse was scrolled down). | * '''upOrDown''': An [[int|integer]] representing whether the scroll was scrolled up or down. This can be either '''1''' (mouse was scrolled up) or '''-1''' (mouse was scrolled down). | ||
==Source== | ==Source== | ||
The [[event system#Event source|source]] of this event is the GUI element on which the mouse scroll was scrolled. | The [[event system#Event source|source]] of this event is the GUI element on which the mouse scroll was scrolled. | ||
Line 14: | Line 15: | ||
The example tells player in which direction wheel was scrolled (UP or DOWN) and also the type of the GUI element that wheel was scrolled on. | The example tells player in which direction wheel was scrolled (UP or DOWN) and also the type of the GUI element that wheel was scrolled on. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
addEventHandler( "onClientMouseWheel", | addEventHandler( "onClientMouseWheel", root, | ||
function ( up_down ) | function ( up_down ) | ||
outputChatBox( "You scrolled mouse wheel " .. ( up_down == 1 | outputChatBox( "You scrolled mouse wheel " .. ( up_down == 1 and "UP" or "DOWN" ) .. " on " .. getElementType( source ) ) | ||
end | end | ||
) | ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{GUI_events}} | {{GUI_events}} | ||
===Client event functions=== | ===Client event functions=== | ||
{{Client_event_functions}} | {{Client_event_functions}} |
Latest revision as of 14:28, 15 August 2018
This event is triggered each time the user scrolls his mouse scroll on top of a GUI element.
Parameters
int upOrDown
- upOrDown: An integer representing whether the scroll was scrolled up or down. This can be either 1 (mouse was scrolled up) or -1 (mouse was scrolled down).
Source
The source of this event is the GUI element on which the mouse scroll was scrolled.
Example
The example tells player in which direction wheel was scrolled (UP or DOWN) and also the type of the GUI element that wheel was scrolled on.
addEventHandler( "onClientMouseWheel", root, function ( up_down ) outputChatBox( "You scrolled mouse wheel " .. ( up_down == 1 and "UP" or "DOWN" ) .. " on " .. getElementType( source ) ) end )
See Also
Input
GUI
- onClientGUIAccepted
- onClientGUIBlur
- onClientGUIChanged
- onClientGUIClick
- onClientGUIComboBoxAccepted
- onClientGUIDoubleClick
- onClientGUIFocus
- onClientGUIMouseDown
- onClientGUIMouseUp
- onClientGUIMove
- onClientGUIScroll
- onClientGUISize
- onClientGUITabSwitched
- onClientMouseEnter
- onClientMouseLeave
- onClientMouseMove
- onClientMouseWheel
Client event functions
- triggerLatentServerEvent
- triggerServerEvent
- Shared
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled