How do you disable buttons and checkboxes?

Place to get help with not working mods / modding interface.
JasonC
Filter Inserter
Filter Inserter
Posts: 449
Joined: Tue Mar 22, 2016 3:05 am
Contact:

How do you disable buttons and checkboxes?

Post 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.
Took a break from 0.12.29 to 0.17.79, and then to ... oh god now it's 1.something. I never know what's happening.
metalhedd
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sat Apr 16, 2016 6:40 pm
Contact:

Re: How do you disable buttons and checkboxes?

Post 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
JasonC
Filter Inserter
Filter Inserter
Posts: 449
Joined: Tue Mar 22, 2016 3:05 am
Contact:

Re: How do you disable buttons and checkboxes?

Post 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.
Took a break from 0.12.29 to 0.17.79, and then to ... oh god now it's 1.something. I never know what's happening.
Post Reply

Return to “Modding help”