Recent Posts

Pages: [1] 2 3 ... 10
1
Help requests / Re: How to use ScrollablePanel?
« Last post by texus on Yesterday at 22:20:38 »
The clipping bug (that caused the text to be displayed outside the ScrollbablePanel) has now been fixed as well.
This weekend I will add the improvements to the ScrollablePanel class such that the order of the add calls will no longer matter.
2
Help requests / Re: How to use ScrollablePanel?
« Last post by kiwon0905 on Yesterday at 14:54:21 »

Ok i think i just messed up the order of grid.add(scrollPanel); and scrollPanel.add(grid); before.
Thanks.
3
Help requests / Re: How to use ScrollablePanel?
« Last post by texus on Yesterday at 08:42:49 »
Weird, I do get scrollbars with that code. Could you show a complete code, something that I can copy, paste and run so that I have the exact same code?
But the clipping is definately broken, seems like it only took 4 days for someone to find a bug in the new implementation.
The scrolling also seems a bit wrong, I either terribly messed something up in the new clipping code (which was just rewritten from scratch to work around and SFML issue) or there is some other issue in ScrollablePanel that I never noticed yet.
The widgets you are playing with are all relatively new or received quite some recent changes and are thus less tested, so you might hit a bit more issues with them than usual.

Writing something like that is probably not going to be easy, but maybe you can try with a VerticalLayout instead of a Grid. It requires you to manually specify the size, but you might be able to easily calculate it. The width would just be the size of the ScrollbablePanel (maybe minus the scrollbar width) while the height is the amount of items multiplied with the height of each row. You would have to change the height of the VerticalLayout every time you add or remove a row, but I think it might be the best solution.
4
Help requests / Re: How to use ScrollablePanel?
« Last post by kiwon0905 on Yesterday at 03:26:41 »
Hi texus,
I'm trying to make something like this:


I tried inserting HorizontalLayouts to the grids, but I don't get the scrollbars.
auto scrollPanel = tgui::ScrollablePanel::create({ "75%", "75%" });
scrollPanel->getRenderer()->setBackgroundColor(sf::Color::Green);
auto grid = tgui::Grid::create();
for (int i = 0; i < 100; ++i)
{
        auto h = tgui::HorizontalLayout::create({ tgui::bindWidth(scrollPanel), tgui::bindHeight(scrollPanel) / 10 });
        h->add(tgui::Label::create("Hello"));
        h->add(tgui::Label::create("Hello"));
        h->add(tgui::Label::create("Hello"));
        h->add(tgui::Label::create("Hello"));
        grid->addWidget(h, i, 0);
}

gui.add(scrollPanel);
scrollPanel->add(grid);



What would be the best way to implement something like this?
5
Help requests / Re: How to use ScrollablePanel?
« Last post by kiwon0905 on 18 October 2017, 22:17:23 »
The fix works. Thank you for the fast response!
6
Help requests / Re: How to use ScrollablePanel?
« Last post by texus on 18 October 2017, 20:13:00 »
There seem to be 2 unrelated issues. The first one was the bug I expected with Grid and has been fixed now.

The second "issue" is that ScrollbablePanel only checks the size and position of widgets when they are added to it. When "scrollPanel->add(grid);" is executed, the size of the Grid is still (0,0) since all the labels have size (0,0) since they don't have a font yet. When no font is set, the one from the parent is used. The widgets thus only get a size when "gui.add(scrollPanel);" is called but at that point the ScrollbablePanel no longer changes.

I'll soon look into how I will improve the ScrollbablePanel to automatically recalculate when one of its widgets is changed, but for now your code will work if you download the latest version again (to have the fix for the Grid) and swap the order of the "scrollPanel->add(grid);" and "gui.add(scrollPanel);" calls.
7
Help requests / Re: How to use ScrollablePanel?
« Last post by texus on 18 October 2017, 08:08:21 »
I don't have time to actually check it now, but I think the issue is with Grid. I think its size will be (0,0) when no size is given to it.
I'll have a look at this tonight as it looks like a bug that I must have introduced some weeks/months ago when I changed the way the size is handled in Grid. If the issue is as simple as I currently think it is then I should be able to have it fixed today once I get back from work.
8
Help requests / How to use ScrollablePanel?
« Last post by kiwon0905 on 18 October 2017, 03:49:28 »
auto scrollPanel = tgui::ScrollablePanel::create({ "300", "300" });
scrollPanel->getRenderer()->setBackgroundColor(sf::Color::White);
auto grid = tgui::Grid::create();
grid->setAutoSize(true);

for (int r = 0; r < 100; ++r)
        grid->addWidget(tgui::Label::create("h"), r, 0);
scrollPanel->add(grid);
gui.add(scrollPanel);

I'd like the scrollbar to appear when the grid gets bigger than the panel, but I don't see any scrollbar.

9
Help requests / Re: Trouble Loading Theme
« Last post by Crimsowned on 15 October 2017, 20:47:25 »
Ok it works like that. You also cleared up a few things, thanks! :D
10
Help requests / Re: Trouble Loading Theme
« Last post by texus on 15 October 2017, 18:54:11 »
Does it work when you use tgui::Theme::create("C:\Users\charles\TGUI\widgets\Black.txt") ?
Depending on how the executable is run, the file will be searched relative to the executable directory or the IDE project. The code you showed would only work when the executable is placed in "C:\Users\charles" and ran from there.
Pages: [1] 2 3 ... 10