Page 1 of 1

GUI update (Help me, Please)

Posted: Thu May 01, 2025 6:05 pm
by yaim904
Context
Some time ago I created my version of Star whit items, but I couldn't get the GUI to look like the Vanilla GUI.

Now that I'm updating it, I'm in the same place, I don't know what styles to use and in what sequence to use; I also didn't find updated guides on the subject.

I tried to check the GUI with Ctrl + F5 and Ctrl + F6 but I don't understand anything. It's a lot of Flow and I always seem to be missing some detail.

Below is the GUI I made some time ago.
4.png
4.png (18.28 KiB) Viewed 108 times
5.png
5.png (39.74 KiB) Viewed 108 times
6.png
6.png (19.58 KiB) Viewed 108 times
7.png
7.png (19.66 KiB) Viewed 108 times

What I want from the GUI
I want it to look like the infinite chest, with a blank space always at the end (to add the next item).
12.png
12.png (55.68 KiB) Viewed 108 times


When I want to add a new object, the list of objects (like the one in the requirement chests) will be displayed.
13.png
13.png (203.58 KiB) Viewed 108 times

I need help with the GUI, I code the logic.
Help me, Please

Re: [2.0.43] GUI update (Help me, Please)

Posted: Sat May 03, 2025 12:34 am
by yaim904
I have created a Frame as the main container
But I don't know how to add the buttons in the title bar.
In the images you can see that there are two children
How can I select a children from an element?

Code: Select all

---------------------------------------------------------------------------------------------------
---> control.lua <---
---------------------------------------------------------------------------------------------------

script.on_event(defines.events.on_player_created, function(event)
    local player = game.get_player(event.player_index)
    local screen_element = player.gui.screen
    local main_frame = screen_element.add({
        type    = "frame",
        name    = "main_frame",
        style   = "frame_without_left_side",
        caption = "Hello world"
    })
    main_frame.style.size = { 484, 632 }
    main_frame.auto_center = true

    -- main_frame.children[1].add({
    --     type = "button",
    --     style = "close_button"
    -- })
end)
Captura de pantalla (357).png
Captura de pantalla (357).png (5.01 KiB) Viewed 60 times
Captura de pantalla (358).png
Captura de pantalla (358).png (5.1 KiB) Viewed 60 times
Captura de pantalla (359).png
Captura de pantalla (359).png (50.91 KiB) Viewed 60 times
Captura de pantalla (360).png
Captura de pantalla (360).png (70.2 KiB) Viewed 60 times