DgsSetProperty: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Blanked the page)
Line 1: Line 1:
{{Client function}}
__NOTOC__
This function gets the value of a specific property of a DGS element. For a list of properties and their meaning, see the [[template:DGSPROPERTIES | DGS properties page]].


==Syntax==
<syntaxhighlight lang="lua">
string dgsDxGUIGetProperty ( element dgsElement, string property )
</syntaxhighlight>
===Required Arguments===
*'''dgsElement:''' the DGS 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 value of the property. An error will occur if failed.
==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).
<syntaxhighlight lang="lua">
DGS = exports.dgs
button = DGS:dgsDxCreateButton(20, 200, 150, 30, "Test", false)
addCommandHandler("togglebtn",function()
local currentState = DGS:dgsDxGUIGetProperty(button, "enabled")
DGS:dgsDxGUISetProperty(button, "enabled", not currentState)
end)
</syntaxhighlight>
==See Also==
{{DGSFUNCTIONS}}

Revision as of 06:00, 16 December 2017