when is this event called? events.on_gui_selection_state_changed

Place to get help with not working mods / modding interface.
Post Reply
tomdubliner
Manual Inserter
Manual Inserter
Posts: 2
Joined: Sun Jan 21, 2024 6:42 pm
Contact:

when is this event called? events.on_gui_selection_state_changed

Post by tomdubliner »

I have a little mod, with its GUI. On the GUI I have a drop-down list, and I'd like to do some actions whenever the user selects another item from the list.

I have registered a handler for the events.on_gui_selection_state_changed which I believe should be the event I need, but when debugging (I've placed a breakpoint in the function called by the trigger) nothing happens as if the event is not triggered.

example of the handler

Code: Select all

script.on_event(defines.events.on_gui_selection_state_changed, function(event)
game.print(event.element.name)
end)
The only event that gets triggered is when I click on the drop-down list (with event.on_gui_clik) but that only gets me the actual element in the list that is selected at the moment I've clicked, not the element that I'm changing to. I hope this makes sense.

Does any good soul know how this works or which event I can try out to get what I want (is it even possible?)

Rseding91
Factorio Staff
Factorio Staff
Posts: 13219
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: when is this event called? events.on_gui_selection_state_changed

Post by Rseding91 »

Everything seems to work just fine when I test it.
factorio-run_SaPF8J1LRK.mp4
(2.5 MiB) Downloaded 15 times
If you want to get ahold of me I'm almost always on Discord.

tomdubliner
Manual Inserter
Manual Inserter
Posts: 2
Joined: Sun Jan 21, 2024 6:42 pm
Contact:

Re: when is this event called? events.on_gui_selection_state_changed

Post by tomdubliner »

Rseding91 wrote:
Sun Jan 21, 2024 8:51 pm
Everything seems to work just fine when I test it.
Thanks for taking the time to do this test. I have no idea what happened, but now that I got back to the code, without changing a single bit, it worked. :shock:
I ran it this afternoon before posting my distress call here, thousands of times, and wasn't working.

I guess Murphy's law is at play here. :twisted:

Thanks for your response nonetheless. :D

Post Reply

Return to “Modding help”