Page 1 of 1

mui.Setter

Posted: Sun Apr 01, 2018 1:41 pm
by djrikki
This small function allows you to set an attribute to a value on multiple items in one function call, enjoy.

Remove the ExitOnError() block if you don't need it in your environment.

Code: Select all

Global Gui
Gui = {}

/* mui.Set */
Function Gui:Set(objects,attribute,value,postfix)
	ExitOnError(False)
	For i, v In IPairs(objects)
		mui.Set(v .. postfix,attribute,value)
	Next
	ExitOnError(True)
EndFunction
Example usage #1 - multiple items:

Code: Select all

Gui:Set({
	"evo_layout-foldall",
	"evo_layout-unfoldall",
	"evo_layout-remove-gadget"
},"disabled",True)
/* ForEach item in the array/table set the disabled attribute state to True */
Example usage #2 - single item:

Code: Select all

Gui.Set( {"evo_layout-foldall"} , "disabled" , True )
/* Remember the curly braces {} */

Re: mui.Setter

Posted: Sun Apr 01, 2018 2:25 pm
by djrikki
And lastly, if it's a single item and you need to set multiple key/value pairs default back to using mui.Set().