How to use file form generated by GUI_BUILDER?

Started by eugustus, 29 December 2020, 18:55:21

eugustus

Hi. I can't find anywhere how to use the form generated by gui_builder.
Is there a guide, an example or maybe someone can tell me, how I can use the generated code?
Thank you.

P.S. I use TGUI version 0.8.8

texus

You can call gui.loadWidgetsFromFile(filename).
You can also call the function on a Container widget instead of on the Gui, in case you want the form to be loaded inside a child window.

The only place where this is currently mentioned is the tgui homepage. It doesn't belong there, but I placed it there to have it at least mentioned somewhere :)

eugustus

So, the generated form looks like this:

Code (ini) Select
Panel."panel-quick" {
    Size = (110, 400);

    Renderer {
        backgroundcolor = #7F7F7F;
        bordercolor = black;
        font = "/home/denis/projects/test-sfml/data/ubuntu_font/Ubuntu-C.ttf";
        padding = (2, 2, 2, 2);
        texturebackground = None;
    }
}



Loading:

Code (cpp) Select
m_tgui->loadWidgetsFromFile("/home/denis/projects/test-sfml/data/themes/test.txt", true);

I'm getting this error:

Code (none) Select
tgui/src/TGUI/Container.cpp:218: virtual void tgui::Container::add(const Ptr&, const sf::String&): Assertion `widgetPtr != nullptr' failed.

:)



         
         

eugustus

Sorry it's OK. I had a typo in the code ...

Thank you for your help!