GuiGetProperty: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(OOP syntax)
Line 7: Line 7:
string guiGetProperty ( element guiElement, string property )
string guiGetProperty ( element guiElement, string property )
</syntaxhighlight>
</syntaxhighlight>
{{OOP||[[GUI widgets|GuiElement]]:getProperty||guiSetProperty}}


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

Revision as of 16:00, 7 November 2018

This function gets the value of a specific CEGUI property of a GUI element. For a list of properties and their meaning, see the CEGUI properties page.

Syntax

string guiGetProperty ( element guiElement, string property )

OOP Syntax Help! I don't understand this!

Method: GuiElement:getProperty(...)
Counterpart: guiSetProperty


Required Arguments

  • guiElement: the GUI element you wish to get a property of.
  • property: the name of of property you want the value of.

Returns

If the function succeeds, it returns a string with the value of the property. If it fails, it returns false.

Example

This example creates a button when the resource starts and defines a console command that toggles it between enabled (clickable) and disabled (not clickable).

addEventHandler("onClientResourceStart", getResourceRootElement(),
    function()
        button = guiCreateButton(20, 200, 150, 30, "Test", false)
    end
)

addCommandHandler("togglebtn",
    function()
        local currentState = guiGetProperty(button, "Disabled")
        if currentState == "False" then
            guiSetProperty(button, "Disabled", "True")
        else
            guiSetProperty(button, "Disabled", "False")
        end
    end
)

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