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

Messages - guatto

#1
I guess i'll recalculate all that manually or maybe do the calculation inside a class to capture the layout width change. thanks again Texus for all your time !
#2
No, precisely, i wanted my Panel to take the same width as the layout but depending on the width of the widgets that are inside the layout, here is an image to clarify what I want to do:

#3
Hi again, it's okay for the late reply, i'm the one to be sorry for this basic questions, i know you have a busy schedule, so, i tried your method but all it shows me is the titlebar with its default width (400), so i replaced the ChildWindow with a Panel and removed the hardcodes values, but the result is worse , it doesn't show me anything, the returned size is equal to 0 :


    auto panel = tgui::Panel::create(); // Changed to Panel
    auto layout = tgui::HorizontalWrap::create();
    panel->add(layout);

    auto wgt1 = tgui::Label::create("Some words");
    ...

    auto wgt2 = tgui::Label::create("Another things");
    ...

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

    panel->setSize(bindWidth(layout),bindHeight(layout));

    gui.add(panel);
#4
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 ?
#5
Help requests / Re: Align text inside ListBox
23 January 2022, 13:11:54
It works like a charm. Thank you sir !
#6
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 ?