GuiSetProperty

From Multi Theft Auto: Wiki
Revision as of 18:57, 18 January 2008 by Arc (talk | contribs) (New page: {{Client function}} __NOTOC__ This function sets the value of a specific CEGUI property of a GUI element. For a list of properties and their meaning, see the [http://www.cegui.org.uk/wiki...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


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

Syntax

bool guiSetProperty ( element guiElement, string property, string value )

Required Arguments

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

Returns

If the function succeeds it returns true, and false otherwise.

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", getRootElement(),
    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
)