OnDgsElementLeave

From Multi Theft Auto: Wiki
Revision as of 11:51, 11 February 2023 by Thisdp (talk | contribs) (Created page with "{{Client event}} __NOTOC__ This event is fired when the user moves the mouse away from 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 </syntaxhighlight> * '''absoluteX''': the X position of the mouse cursor, in pixels, measured from the left side of the screen. * '''absoluteY'...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This event is fired when the user moves the mouse away from 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

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 moved away from.

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( "onDgsElementLeave", imageA, function(aX, aY)
	outputChatBox( "You left DGS element at ("..tostring(aX)..", "..tostring(aY)..")")
end)