mod_gui without children

Place to get help with not working mods / modding interface.
kurtzilla
Inserter
Inserter
Posts: 27
Joined: Tue Feb 26, 2019 6:54 pm
Contact:

mod_gui without children

Post by kurtzilla »

My mod uses mod_gui and I place button elements in the top gui - button_flow
There are cases where I would like to have the ability to toggle the display of my mods buttons and I have that worked out

...Except, when I turn my mod's display (mod.destroy()) I am left with essentially, a top gui artifact. The empty frames are being drawn and I can't figure out the proper way to either remove or make not visible, let alone a good/better way to detect the empty inner_frame than a bunch of if statements walking the top gui structure to determine that the top gui is indeed empty.


Before:
Screenshot 2025-02-06 164817.png
Screenshot 2025-02-06 164817.png (480.26 KiB) Viewed 263 times

After:
Screenshot 2025-02-06 165202.png
Screenshot 2025-02-06 165202.png (71.35 KiB) Viewed 263 times

More detail:
Screenshot 2025-02-06 165239.png
Screenshot 2025-02-06 165239.png (1.03 MiB) Viewed 263 times
User avatar
yaim904
Fast Inserter
Fast Inserter
Posts: 101
Joined: Wed Nov 17, 2021 11:26 pm
Contact:

Re: mod_gui without children

Post by yaim904 »

Hi, can you share the code to do some tests?
It doesn't have to be everything, just the essentials.
Solo entiendo español, pero si tu también lo entiendes, escríbeme
:D
Everything i write in English is translated by Deepl.
:D
0n0w1c
Inserter
Inserter
Posts: 30
Joined: Sat Sep 09, 2023 1:43 pm
Contact:

Re: mod_gui without children

Post by 0n0w1c »

I have the same issue and also failed to find a good solution.

Edit: {Persistence}

Code: Select all

for _, player in pairs(game.players) do
    for _, root in pairs({ player.gui.top, player.gui.left }) do
        local artifact = root.mod_gui_top_frame
        if artifact and artifact.valid then
            artifact.destroy()
        end
    end
end
Post Reply

Return to “Modding help”