My mod has 2 GUIs on player.gui.screen. When I turn them on, I will use LuaGuiElement.bring_to_front() to make sure they are visible. One of them ("Available characters") can become quite small, as you can see in this screenshot:
Is there any way to find out whether a particular GUI element is hidden, or at least if it is on top? If so, I could check whether my GUI is visible but possibly hidden and bring it to the front instead of turning it off when the toggle button is used.
In this case the small GUI is on top, so it is visible. But if the bigger GUI gets the focus, the small one will be completely hidden. The button flow at the top left of the screen contains the buttons that toggle GUI visibility. Now, if the small GUI is hidden by something else, clicking the "Available characters" button will (apparently!) do nothing: The GUI already is visible, so using the button will make it invisible, and only on the next click will it be visible (and in the foreground) again.Which LuaGuiElement is in front?
Which LuaGuiElement is in front?
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Re: Which LuaGuiElement is in front?
I would like to help you, but I don't think I understand what the problem is.
If what you want is to prevent the windows from overlapping, place it to one side of the main one
While you don't need the window, hide it with the "element.style.visible = false" property or destroy it.
If what you want is to prevent the windows from overlapping, place it to one side of the main one
Code: Select all
script.on_event(defines.events.on_player_created, function(event)
local player = game.get_player(event.player_index)
local anchor = {gui=defines.relative_gui_type.controller_gui, position=defines.relative_gui_position.top}
local frame = player.gui.relative.add{type="frame", anchor=anchor}
frame.add{type="label", caption=player.name}
end)
While you don't need the window, hide it with the "element.style.visible = false" property or destroy it.
Solo entiendo español, pero si tu también lo entiendes, escríbeme
Everything i write in English is translated by google.