[0.16.1] Checkboxes not raising `on_gui_click`

Things that has been reported already before.
Post Reply
User avatar
Narc
Filter Inserter
Filter Inserter
Posts: 278
Joined: Mon Feb 11, 2013 7:25 am
Contact:

[0.16.1] Checkboxes not raising `on_gui_click`

Post by Narc »

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)?
Last edited by Narc on Thu Dec 14, 2017 11:39 am, edited 1 time in total.

Aidiakapi
Long Handed Inserter
Long Handed Inserter
Posts: 51
Joined: Fri Apr 14, 2017 6:13 pm
Contact:

Re: Checkboxes not raising `on_gui_click`

Post by Aidiakapi »

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:

Code: Select all

local function handler()... end
script.on_event(defines..., handler) -- for each event

Loewchen
Global Moderator
Global Moderator
Posts: 8308
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: Checkboxes not raising `on_gui_click`

Post by Loewchen »

What version is this about?

User avatar
Narc
Filter Inserter
Filter Inserter
Posts: 278
Joined: Mon Feb 11, 2013 7:25 am
Contact:

Re: Checkboxes not raising `on_gui_click`

Post by Narc »

Loewchen wrote:What version is this about?
Erp! Sorry, it's for 0.16.1. Edited the title, thanks for the reminder.
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.[...]
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:If your code can handle it fine, you can just use the same function as event handlers for both:
Yes, that's what I meant by
Narc wrote:(luckily, they're sufficiently similar that I can ram them down the same path anyway)
in the original post.

Bilka
Factorio Staff
Factorio Staff
Posts: 3129
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: [0.16.1] Checkboxes not raising `on_gui_click`

Post by Bilka »

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.

User avatar
Narc
Filter Inserter
Filter Inserter
Posts: 278
Joined: Mon Feb 11, 2013 7:25 am
Contact:

Re: [0.16.1] Checkboxes not raising `on_gui_click`

Post by Narc »

So it is, good find! I did try a search, but apparently with the wrong terms. Glad to know this is intended behaviour, then.

Post Reply

Return to “Duplicates”