Page 1 of 1
How do you disable buttons and checkboxes?
Posted: Wed Apr 20, 2016 5:44 pm
by JasonC
Buttons and checkboxes have disabled graphics in their styles.
How do you disable/enable them?
In
http://lua-api.factorio.com/0.12.29/LuaGuiElement.html there doesn't seem to be an enable/disable state.
Re: How do you disable buttons and checkboxes?
Posted: Thu Apr 21, 2016 11:17 pm
by metalhedd
I was wondering the same thing, and was going to try creating a style that 'looks' disabled, then on_click check if that style is set and ignore the click.
I haven't actually tried this yet, so if you do, post back and let me know if it worked
update: There is actually a style called "fake_disabled_button_style" already in the game. just set that, and in your gui click handler if event.element.style.name == 'fake_disabled_button_style' bail out early
Re: How do you disable buttons and checkboxes?
Posted: Fri Apr 22, 2016 12:51 am
by JasonC
metalhedd wrote:I was wondering the same thing, and was going to try creating a style that 'looks' disabled, then on_click check if that style is set and ignore the click. ... update: There is actually a style called "fake_disabled_button_style" already in the game. just set that, and in your gui click handler if event.element.style.name == 'fake_disabled_button_style' bail out early
Hey, that's a good idea.
The bigger motivation behind my question is whether I should bother going through the effort of creating graphic sets for disabled_background (checkboxes) and disabled_graphical_set (buttons), or if those were just an API dead-end.
I probably should specify them in any case just as good form, though.