How to use gui drop-down

Place to get help with not working mods / modding interface.
User avatar
WIZ4
Fast Inserter
Fast Inserter
Posts: 209
Joined: Thu Apr 07, 2016 1:36 pm
Contact:

How to use gui drop-down

Post by WIZ4 »

I can not register click to item in drop-down

Code: Select all

frame.add{type = "drop-down", name = "drop_down_button"}
frame.drop_down_button.add_item("drop_down_1",1)

Code: Select all

script.on_event(defines.events.on_gui_click, function(event)
local player = game.players[event.element.player_index]
local name = event.element.name
local frame = player.gui.center["frame"]
if (name == "drop_down_1") then
player.print("text")
end
end)
When I click on an item nothing happens. How can I do this differently?
My native language is russian. Sorry if my messages are difficult to read.
Bilka
Factorio Staff
Factorio Staff
Posts: 3405
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: How to use gui drop-down

Post by Bilka »

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
WIZ4
Fast Inserter
Fast Inserter
Posts: 209
Joined: Thu Apr 07, 2016 1:36 pm
Contact:

Re: How to use gui drop-down

Post by WIZ4 »

Thanks
My native language is russian. Sorry if my messages are difficult to read.
Post Reply

Return to “Modding help”