GuiGetSize: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
Line 17: Line 17:
This example creates a random sized gui window and outputs its size to the chatbox.
This example creates a random sized gui window and outputs its size to the chatbox.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
local window = guiCreateWindow ( 0, 0, randInt ( 0, 100 ) / 100, randInt ( 0, 100 ) / 100, "test", true )
-- Create the window
-- Create the window
local window = guiCreateWindow ( 0, 0, randInt ( 0, 100 ) / 100, randInt ( 0, 100 ) / 100, "test", true )
local x, y = guiGetSize ( window ) -- Get the gui window sizes
-- Get its size and output to chatbox
outputChatBox ( "Window size: " .. x .. " " .. y ) --output the gui window size
local x, y = guiGetSize ( window )
outputChatBox ( "Window size: " .. x .. " " .. y )
</syntaxhighlight>
</syntaxhighlight>



Revision as of 03:02, 8 October 2007

This function gets the size of a GUI element.

Syntax

float, float guiGetSize ( element theElement )

Required Arguments

  • theElement: The GUI element to get size of

Returns

Returns the GUI element size if the function has been successful, false otherwise.

Example

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

local window = guiCreateWindow ( 0, 0, randInt ( 0, 100 ) / 100, randInt ( 0, 100 ) / 100, "test", true ) 
-- Create the window
local x, y = guiGetSize ( window ) -- Get the gui window sizes
outputChatBox ( "Window size: " .. x .. " " .. y ) --output the gui window size

See Also

General functions

Browsers

Buttons

Checkboxes

Comboboxes

Edit Boxes

Gridlists

Memos

Progressbars

Radio Buttons

Scrollbars

Scrollpanes

Static Images

Tab Panels

Tabs

Text Labels

Windows

-- leave this until syntax is available. Cannot document the function or event without syntax.