Page 1 of 1

LuaGuiElement::enabled read/write

Posted: Tue Sep 06, 2016 4:18 pm
by Mooncat
While I was messing with GUI style prototypes, I noticed that we actually have images for disabled elements. Also, when I was testing multiplayer for my mod, I saw that the menu was disabled when I quite the game.
disabled_menu.png
disabled_menu.png (40.84 KiB) Viewed 1240 times
But it seems that we currently don't have any API for disabling/enabling a GUI element. I wish we can have a new read/write property for doing so.
By disabling a GUI element, 3 things will be done:
1) change its appearance if it is a button, checkbox, etc.
2) it becomes not interactive and cannot raise the on_gui events
3) all of its children are also disabled. (However, this is different from directly disabling the child elements. If we don't disable the children but only the parent, we can restore all of them by just enabling the parent.)

This will make our GUI system easier to use as we will have an additional, visually different option to "kill" GUI elements. :lol:

Re: LuaGuiElement::enabled read/write

Posted: Tue Sep 06, 2016 4:57 pm
by aubergine18
Yes, definitely want this!!

Re: LuaGuiElement::enabled read/write

Posted: Wed Sep 07, 2016 7:44 am
by bobingabout
Yes, I agree. I could use this myself for my Inserters GUI, so instead of having to draw a blank, I can disable the button in that place instead.