DgsGetCursorPosition

From Multi Theft Auto: Wiki

This function gets the position of the cursor and can be relative to a dgs element.

Syntax

float/int, float/int dgsGetCursorPosition ( [ element dgsElement, bool relative ] )

Required Arguments

  • dgsElement: The dgs element that you want to relative to.
  • relative: This is whether positioning are relative. If this is true, then all width,height floats must be between 0 and 1, representing positions as a fraction of the dgsElement size. If false, then the co-ordinates will be absolute pixels on screen.

Returns

Returns two numbers indicates x and y coordinate if successful, false otherwise.

Example

This example creates a dgs window and brings it on top.

DGS = exports.dgs

local window = DGS:dgsCreateWindow ( 0.4, 0.4, 0.3, 0.3, "Window", true )
addEventHandler("onClientRender",root,function()
	local x,y = DGS:dgsGetCursorPosition(window)
	dgsSetText(window,"X:"..x..";"Y:"..y)
end)

See Also

Multi Language Supports

Animation

3D Interface

3D Text

Arrow List

Browser

Button

Check Box

Combo Box

Edit

Ellipse Detect Area

Detect Area

Grid List

Image

Memo

Label

Progress Bar

Radio Button

Scroll Bar

Scroll Pane

Switch Button

Tab Panel

Window

Plugin

Media Browser

Rounded Rectangle

Color Picker

Blur Box

Effect 3D