OnDgsElementEnter: 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 the user moves the mouse over a DGS element even this DGS element is blocked by other DGS elements. '''But you have to set property enableFullEnterLeaveCheck of the DGS element to ''true'''''. ==Parameters== <syntaxhighlight lang="lua"> int absoluteX, int absoluteY, element leftGUI </syntaxhighlight> * '''absoluteX''': the X position of the mouse cursor, in pixels, measured from the left side of the screen. * '...")
 
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Client event}}
{{Client event}}
__NOTOC__  
__NOTOC__  
This event is fired when the user moves the mouse over a DGS element even this DGS element is blocked by other DGS elements. '''But you have to set property [[enableFullEnterLeaveCheck]] of the DGS element to ''true'''''.
This event is fired when the user moves the mouse over a DGS element even this DGS element is blocked by other DGS elements. This function is different from [[onDgsMouseEnter]].
 
'''You have to set property [[DGS_General_Basic_Properties#enableFullEnterLeaveCheck|enableFullEnterLeaveCheck]] of the DGS element to ''true'' to use this event''' because full enter leave check is a little bit costly for cpu resource.


==Parameters==  
==Parameters==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
int absoluteX, int absoluteY, element leftGUI
int absoluteX, int absoluteY
</syntaxhighlight>  
</syntaxhighlight>  
* '''absoluteX''':  the X position of the mouse cursor, in pixels, measured from the left side of the screen.
* '''absoluteX''':  the X position of the mouse cursor, in pixels, measured from the left side of the screen.
* '''absoluteY''':  the Y position of the mouse cursor, in pixels, measured from the top of the screen.
* '''absoluteY''':  the Y position of the mouse cursor, in pixels, measured from the top of the screen.
==Source==
==Source==
The [[event system#Event source|source]] of this event is the DGS element that was pointed at.
The [[event system#Event source|source]] of this event is the DGS element that was pointed at.

Latest revision as of 06:00, 5 October 2023

This event is fired when the user moves the mouse over a DGS element even this DGS element is blocked by other DGS elements. This function is different from onDgsMouseEnter.

You have to set property enableFullEnterLeaveCheck of the DGS element to true to use this event because full enter leave check is a little bit costly for cpu resource.

Parameters

int absoluteX, int absoluteY
  • absoluteX: the X position of the mouse cursor, in pixels, measured from the left side of the screen.
  • absoluteY: the Y position of the mouse cursor, in pixels, measured from the top of the screen.

Source

The source of this event is the DGS element that was pointed at.

Example

This example shows a message when you move over a DGS element.

DGS = exports.dgs

local imageA = DGS:dgsCreateImage(300,300,400,400,_,false,_,tocolor(128,0,0,255))
local imageB = DGS:dgsCreateImage(0,0,400,400,_,false,imageA,tocolor(128,0,0,255))
DGS:dgsSetProperty(imageA,"enableFullEnterLeaveCheck",true)

addEventHandler( "onDgsElementEnter", imageA, function(aX, aY)
	outputChatBox( "You entered DGS element at ("..tostring(aX)..", "..tostring(aY)..")")
end)

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