How to use file form generated by GUI_BUILDER?

  • 3 Replies
  • 88 Views
*

eugustus

  • *
  • 4
  • Novice
    • View Profile
How to use file form generated by GUI_BUILDER?
« on: 29 December 2020, 18:55:21 »
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

  • *****
  • 1592
    • View Profile
    • Texus's Blog
Re: How to use file form generated by GUI_BUILDER?
« Reply #1 on: 29 December 2020, 18:58:24 »
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

  • *
  • 4
  • Novice
    • View Profile
Re: How to use file form generated by GUI_BUILDER?
« Reply #2 on: 29 December 2020, 19:22:10 »
So, the generated form looks like this:

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:

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

I'm getting this error:

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

:)



         
         

*

eugustus

  • *
  • 4
  • Novice
    • View Profile
Re: How to use file form generated by GUI_BUILDER?
« Reply #3 on: 29 December 2020, 19:27:24 »
Sorry it's OK. I had a typo in the code ...

Thank you for your help!