OnClientMouseWheel: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: {{Client event}} __NOTOC__ This event is triggered each time the user scrolls his mouse scroll on top of a GUI element. ==Parameters== <syntaxhighlight lang="lua"> int upOrDown </syntaxhighlight> * '''upOrDown'...)
 
Line 12: Line 12:


==Example==  
==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.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--TODO
addEventHandler( "onClientMouseWheel", getRootElement( ),
    function ( up_down )
        outputChatBox( "You scrolled mouse wheel " .. ( up_down == 1 ) and "UP" or "DOWN" .. " on " .. getElementType( source ) );
    end
);
</syntaxhighlight>
</syntaxhighlight>


Line 21: Line 26:
===Client event functions===
===Client event functions===
{{Client_event_functions}}
{{Client_event_functions}}
[[Category:Needs Example]]

Revision as of 18:11, 5 October 2009

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", getRootElement( ),
    function ( up_down )
        outputChatBox( "You scrolled mouse wheel " .. ( up_down == 1 ) and "UP" or "DOWN" .. " on " .. getElementType( source ) );
    end
);

See Also

GUI events

Input

GUI


Client event functions