Page 1 of 1

{0.18.15-Steam} No GUI redraw after saves load

Posted: Mon Mar 23, 2020 9:43 am
by telikey
Hi everyone (and thanks for help if any)
I draw GUI in control.lua on

Code: Select all

player.gui.top
And if there is any changes in code, after i load my save there is no changes until i create a new game.
It is bug? or what?

P.S.: If i draw GUI for click on a button it is always have changes. (So normal behaviour)

P.P.S: My code for top GUI

Code: Select all

local gui = player.gui.top.GlobalMarket_market_flow

	if gui==nil then
		if player.admin then
			local tr = player.gui.top.add({type = "flow",name="GlobalMarket_market_admin_flow", direction = "horizontal"})
			local btn=tr.add({type = "button",name = "GlobalMarket_market_admin_button", font_color = colors.white,caption="Admin"})
			btn.style.top_margin=5
			btn.style.height=30
		end
		gui = player.gui.top.add({type = "flow",name="GlobalMarket_market_flow", direction = "horizontal"})
		local btn=gui.add({type = "button",name = "GlobalMarket_market_button", font_color = colors.white,caption={"Market.GlobalMarket_market_button",""}})
		btn.style.top_margin=5
		btn.style.height=30

		local tmp=player.gui.top.add({type = "flow",name="GlobalMarket_market_frame_flow"})
		--tmp.style.top_margin=5
		local frame=tmp.add({type = "frame",name="GlobalMarket_market_frame", direction = "horizontal"})
		frame.style.top_margin=5
		frame.style.height=30
		frame.style.maximal_width=1000
		local label=frame.add({type="label",name="GlobalMarket_market_label"})
		label.style.horizontal_align="center"
		label.style.vertical_align="center"
	end

Re: {0.18.15-Steam} No GUI redraw after saves load

Posted: Mon Mar 23, 2020 9:56 am
by Deadlock989
If you change the code that creates a gui, existing guis won't know that.

You have to re-create it. If it's a gui that's on the screen all the time then I would guess that most people use the on_configuration_changed event.

Re: {0.18.15-Steam} No GUI redraw after saves load

Posted: Mon Mar 23, 2020 10:13 am
by telikey
Oh, i understand
My fault

Thank you)