Main Menu
Menu

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.

Show posts Menu

Topics - guatto

#1
Hi, i have a ChildWindow and i want to make it fit to the width of the HorizontalWrap, i didn't found any function to do that "automatically", here's my code :


    auto childWindow = tgui::ChildWindow::create();
    auto layout = tgui::HorizontalWrap::create();
    childWindow->add(layout);

    auto wgt1 = tgui::Label::create("Some words");
    wgt1->getRenderer()->setBackgroundColor({250,0,0});
    wgt1->getRenderer()->setTextColor({0,0,0});
    wgt1->setVerticalAlignment(tgui::Label::VerticalAlignment::Center);

    auto wgt2 = tgui::Label::create("Another things");
    wgt2->getRenderer()->setBackgroundColor({0,0,255});
    wgt2->getRenderer()->setTextColor({0,0,0});
    wgt2->setVerticalAlignment(tgui::Label::VerticalAlignment::Center);

    layout->add(wgt1);
    layout->add(wgt2);

    //HERE - How to make the parent's size automatically fit its children's size ?

    gui.add(childWindow);


Any idea please ?
#2
Help requests / Align text inside ListBox
23 January 2022, 11:59:51
Hi, i'm new in this forum and also new to TGUI, as the title suggests, i'm looking for a way to align my text inside the `ListBox`, as an example, with `Label` we can find :


    auto label = tgui::Label::create("Test");
    label->setHorizontalAlignment(tgui::Label::HorizontalAlignment::Center);
    label->setVerticalAlignment(tgui::Label::VerticalAlignment::Center);


Is there any function or hack to replicate this behavior with the ListBox's ?