DgsGetSize: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 4: Line 4:
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
float float dgsGetSize ( element theElement, bool relative )
float, float dgsGetSize ( element theElement, bool relative )
</syntaxhighlight>  
</syntaxhighlight>  



Revision as of 03:29, 6 November 2018

This function gets the size of a DGS element.

Syntax

float, float dgsGetSize ( element theElement, bool relative )

Required Arguments

  • theElement: The DGS element to get size of.
  • relative: This is whether sizes and positioning are relative. If this is true, then all x,y,width,height floats must be between 0 and 1, representing sizes relative to the parent.

Returns

Returns the DGS element size x and y if the function has been successful, false otherwise.

Example

This example creates a random sized dgs window and outputs its size to the chatbox.

DGS = exports.dgs
local window = DGS:dgsCreateWindow ( 0, 0, (math.random ( 0, 100 ) / 100), (math.random ( 0, 100 ) / 100), "test", true ) 
-- Create the window
local x, y = DGS:dgsGetSize ( window, false ) -- Get the dgs window size
outputChatBox ( "Window size: " .. x .. " " .. y ) --output the dgs window size

See Also

Custom Cursor Functions

Multi Language Supports

Animation

3D Element

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

Menu

Label

Layout

Line

Progress Bar

Radio Button

Scale Pane

Scroll Bar

Scroll Pane

Selector

Style

Switch Button

Tab Panel

Window

Basic Shape Plugins

Circle

Quadrilateral

Rounded Rectangle

Other Plugins

Blur Box

Canvas

Chart

Color Picker

Effect 3D

Gradient

Mask

Media Browser

Nine Slice

Object Preview Supports

Paste Handler

QRCode

Remote Image

Screen Source

SVG

Tooltips