Updated utils.gui

This commit is contained in:
Cooldude2606
2019-05-06 13:42:59 +01:00
parent 6d1c907484
commit 82a7963463

View File

@@ -180,7 +180,7 @@ Gui.on_player_show_top = custom_handler_factory(on_visible_handlers)
Gui.on_pre_player_hide_top = custom_handler_factory(on_pre_hidden_handlers) Gui.on_pre_player_hide_top = custom_handler_factory(on_pre_hidden_handlers)
--- Allows the player to show / hide this element. --- Allows the player to show / hide this element.
-- The element must be in Gui.get_top_element_flow(player). -- The element must be in Gui.get_top_element_flow(player)
-- This function must be called in the control stage, i.e not inside an event. -- This function must be called in the control stage, i.e not inside an event.
-- @param element_name<string> This name must be globally unique. -- @param element_name<string> This name must be globally unique.
function Gui.allow_player_to_toggle_top_element_visibility(element_name) function Gui.allow_player_to_toggle_top_element_visibility(element_name)
@@ -210,13 +210,14 @@ Event.add(
return return
end end
local b = local top = Gui.get_top_element_flow(player)
Gui.get_top_element_flow(player).add {
local b = top.add {
type = 'button', type = 'button',
name = toggle_button_name, name = toggle_button_name,
style = mod_gui.button_style,
caption = '<', caption = '<',
style=mod_gui.button_style, tooltip = {'gui_util.button_tooltip'}
tooltip = 'Shows / hides the Redmew Gui buttons.'
} }
local style = b.style local style = b.style
style.width = 18 style.width = 18
@@ -288,4 +289,4 @@ if _DEBUG then
end end
end end
return Gui return Gui