I'm using some checkboxes in my mod GUIs, and was relying on the documented (ctrl+F "checkbox") behaviour that they would raise `on_gui_click` when clicked -- this simplifies my GUI handling by using the same code for both buttons and checkboxes.
But now I see that checkboxes only raise `on_gui_checked_state_changed` anymore, so I have to handle both separately (luckily, they're sufficiently similar that I can ram them down the same path anyway).
Question is, is this an intended change (do the docs need updating?) or a mistake (will Factorio change again)?
[0.16.1] Checkboxes not raising `on_gui_click`
[0.16.1] Checkboxes not raising `on_gui_click`
Last edited by Narc on Thu Dec 14, 2017 11:39 am, edited 1 time in total.
Re: Checkboxes not raising `on_gui_click`
Strange that the docs say this. I've done a lot of GUI stuff in latest 0.15, and checkboxes definitely did not fire the on_click event. I think it's a mistake to make two events input events fire for one action though.
If your code can handle it fine, you can just use the same function as event handlers for both:
If your code can handle it fine, you can just use the same function as event handlers for both:
Code: Select all
local function handler()... end
script.on_event(defines..., handler) -- for each event
Re: Checkboxes not raising `on_gui_click`
What version is this about?
Re: Checkboxes not raising `on_gui_click`
Erp! Sorry, it's for 0.16.1. Edited the title, thanks for the reminder.Loewchen wrote:What version is this about?
Well, EvoGUI has always relied on just on_gui_click, but the change could easily originate in some later 0.15 -- I had 0.15.32 as my last played, and I'm not sure if I even used the checkboxes in that one so it could be even older.Aidiakapi wrote:Strange that the docs say this. I've done a lot of GUI stuff in latest 0.15, and checkboxes definitely did not fire the on_click event.[...]
Yes, that's what I meant byAidiakapi wrote:If your code can handle it fine, you can just use the same function as event handlers for both:
in the original post.Narc wrote:(luckily, they're sufficiently similar that I can ram them down the same path anyway)
Re: [0.16.1] Checkboxes not raising `on_gui_click`
Duplicate: 54678
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Re: [0.16.1] Checkboxes not raising `on_gui_click`
So it is, good find! I did try a search, but apparently with the wrong terms. Glad to know this is intended behaviour, then.