Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - nolimitee

Pages: [1]
1
Help requests / Grid
« on: 14 March 2019, 09:39:20 »
Hello,

I'm currently trying to use Grid but I'm facing weird behavior.

The spacing between my widgets in the grid are way too important if I'm trying to create more than one row. So, my widgets are overflowing my parent container.
The grid is in vertical layout, and the vertical layout is in a Group::Ptr.

I've took multiple screenshots :

Screen with 5 widgets, 5 per row : "5elm-5pr.jpg"
Screen with 6 widgets, 5 per row : "6elm-5pr.jpg"
Screen with 12 widgets, 5 per row : "12elm-5pr.jpg"

And here is the code :

        container_ = tgui::Group::create({ "30%", "100% " });
        container_->setPosition({ "70%", "0%" });

        verticalLayout_ = tgui::VerticalLayout::create();

        tgui::Button::Ptr button = tgui::Button::create("");
        button->getRenderer()->setTexture(ResourceManager::GetInstance().getTextureByName("panel"));
        button->setSize(75, 75);

        grid_ = tgui::Grid::create();

        for (int i = 0; i < 12; ++i) {
                tgui::Button::Ptr butt = tgui::Button::copy(button);
                grid_->addWidget(butt, i / 5, i % 5);
        }

        verticalLayout_->add(grid_);

        container_->add(verticalLayout_);

        Gui.add(container_);
 

As you can see, the "5elm-5pr.jpg" is ok because the row number is always equals to "0". But when I'm trying to create more than row (e.g "6elm-5pr.jpg"), everything explodes.

Am i missing something ?

Thanks

EDIT :

I found out that this problem occurs only when the grid is in the vertical layout (c.f . 6elm-5pr-without-verticallayout.jpg").
But I would like to keep that layout. Is there a solution to compact the grid when it used in the layout ?

2
Help requests / Set widget to unclickable
« on: 06 March 2019, 15:18:08 »
Hello everyone,

How can I make a widget unclickable (e.g. with a tgui::Label) ? And by that, I mean tgui::handleEvent() stops returning me true when I click/hover to the widget.
I tried with ignoreMouseEvents(), but the tgui::handleEvent() keeps returning me true.
 
Thanks

Pages: [1]