OnDgsMouseDoubleClick: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Client event}} __NOTOC__ This event occurs when double clicking on any dgs-element. ==Parameters== <syntaxhighlight lang="lua"> string button, int absoluteX, int absoluteY...")
 
No edit summary
Line 21: Line 21:
button = DGS:dgsDxCreateButton(0.3, 0.3, 0.1, 0.05, "Button", true)
button = DGS:dgsDxCreateButton(0.3, 0.3, 0.1, 0.05, "Button", true)


addEventHandler( "onClientDgsDxMouseDoubleClick", button,  
addEventHandler( "onDgsMouseDoubleClick", button,  
     function(button, x, y)
     function(button, x, y)
if button == 'left' then
if button == 'left' then

Revision as of 13:31, 20 January 2018

This event occurs when double clicking on any dgs-element.

Parameters

string button, int absoluteX, int absoluteY
  • button: the name of the button which will be clicked , it can be left, right, middle
  • 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 double clicked.

Example

This example creates a text button and clicking on it will tell you the position coordinates of the mouse cursor:

DGS = exports.dgs

button = DGS:dgsDxCreateButton(0.3, 0.3, 0.1, 0.05, "Button", true)

addEventHandler( "onDgsMouseDoubleClick", button, 
    function(button, x, y)
		if button == 'left' then
			outputChatBox("This is a test button clicked on X: " .. x .. " Y: " .. y)
		end
    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