LuaGUIElement.state :: string [RW]
Posted: Mon Jun 08, 2020 11:49 pm
TL;DR
Add "state" field to LuaGUIElement for all "clickable" elements (buttons, tabs and so on)Value - [clicked/hovered/selected] or nil if none of this.
What ?
Adding "state" field for all element is a time saving addition for mod developers.For now, if you want to handle all possible states, you must to change style of element by hand.
For example tabs:
If i creating tabs not as part of "tabbed-pane", then i must to write additional handlers to change style for selected one and discard changes for others. Plus "tab-content" behaviour.
Same situation if i want to make group of buttons (usual, radio, checkboxes) when i click one of them, all other must be unselected/disabled and so on. You say a simple 3 line loop? If it were that simple ...
But what if i need to manage more than 2 different state? Additional styles?
Why ?
In some reason this is not been added by default. And as i know, it's most elegant way to manage different states of gui element.I don't think it is too hard to hardcoded such behaviour. But as result it makes unnecessary to creating additional styles for different states and will minimizing additional code to change state and manage relations.