DgsGetCursorPosition

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

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

Custom Cursor Functions

Multi Language Supports

Animation

3D Interface

3D Line

3D Image

3D Text

Browser

Button

Check Box

Combo Box

Custom Renderer

Edit

Detect Area

Drag'N Drop

Grid List

Image

Memo

Label

Line

Progress Bar

Radio Button

Scale Pane

Scroll Bar

Scroll Pane

Selector

Style

Switch Button

Tab Panel

Window

Plugin

Blur Box

Color Picker

Canvas

Circle

Effect 3D

Gradient

Media Browser

Mask

Nine Slice

Object Preview Supports

Paste Handler

QRCode

Remote Image

Rounded Rectangle

Screen Source