{0.18.15-Steam} No GUI redraw after saves load

Place to get help with not working mods / modding interface.
Post Reply
telikey
Manual Inserter
Manual Inserter
Posts: 2
Joined: Mon Mar 23, 2020 9:35 am
Contact:

{0.18.15-Steam} No GUI redraw after saves load

Post 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

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

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

Post 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.
Image

telikey
Manual Inserter
Manual Inserter
Posts: 2
Joined: Mon Mar 23, 2020 9:35 am
Contact:

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

Post by telikey »

Oh, i understand
My fault

Thank you)

Post Reply

Return to “Modding help”