Broken Layouts?

Started by ungod, 01 September 2017, 09:30:27

ungod

Hi,

I cant figure out why the following code is not working. I'm using the latest dev version 0.8.
My problem occurs when I try to reference another widget (parent or sibling) in a layout-string.
It seems like the parsing it these cases is broken, or is something wrong with the code below?

Code (cpp) Select

#include <SFML/Graphics.hpp>
#include <TGUI/TGUI.hpp>
int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "gui test");
    window.setFramerateLimit(60);

    tgui::Gui gui(window);

    try
    {
        tgui::Theme theme{"data/Black.txt"};

        auto button1 = tgui::Button::create();
        auto button2 = tgui::Button::create();
        auto group = tgui::Group::create();

        group->add(button1, "button");
        group->add(button2);

        button1->setRenderer(theme.getRenderer("Button"));
        button2->setRenderer(theme.getRenderer("Button"));

        button2->setPosition({"button.right + 100", "button.top"});  //error here

        gui.add(group);

    }
    catch (const tgui::Exception& e)
    {
        std::cerr << "TGUI Exception: " << e.what() << std::endl;
        return -1;
    }

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();

            gui.handleEvent(event);
        }

        window.clear();
        gui.draw();
        window.display();
    }

    return 0;
}


edit: The version 0.8 from the website works fine, but the latest github version is buggy. Anyway, the problem might be worth noticing.

texus

QuoteThe version 0.8 from the website works fine, but the latest github version is buggy
These versions are identical, the source code button is just a link to the github download. The VS2015 libs on the download page are however delayed 30 minutes (because they have to be build after the commit is made).

I did fix an issue yesterday where the layout did not work properly when the widget is added to a group, your code looks exactly like that issue. Maybe you downloaded the github version a bit before the fix? I would expect it to work if you try the github version again.

ungod

It worked and yes, my github version was a few days (too) old. :)