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 :
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 ?
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 :
Code (cpp) Select
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 ?