GuiGetText: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Added OOP Syntax)
Line 8: Line 8:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
string guiGetText ( element guiElement )
string guiGetText ( element guiElement )
</syntaxhighlight>  
</syntaxhighlight>
{{OOP||[[Element|guiElement]]:getText|text|guiSetText}}


===Required Arguments===  
===Required Arguments===  

Revision as of 22:55, 29 December 2015

This function is used to get the text of GUI elements like edit boxes, labels, buttons etc.

Syntax

string guiGetText ( element guiElement )

OOP Syntax Help! I don't understand this!

Method: guiElement:getText(...)
Variable: .text
Counterpart: guiSetText


Required Arguments

  • guiElement: element you wish to get text of.

Returns

Returns a string containing the requested element's text, or false if the gui element passed to the function is invalid.

Example

This example gets the text of a pre-made gui element and outputs it to chat box.

-- We create a dummy gui label to get text of
local dummyGUIElement = guiCreateLabel ( 0.45, 0.48, 0.10, 0.04, "Hello world", true )
-- Output the text of the label to chat box
outputChatBox ( "Text in the GUI label: " .. guiGetText ( dummyGUIElement ) )

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