littleflylongbow / guichan

Automatically exported from code.google.com/p/guichan
Other
0 stars 0 forks source link

TabbedArea does not call the logic()-method of its children #137

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
TabbedArea does not call the logic()-method of its children.

What steps will reproduce the problem?
This code will reproduce a problem that occurs with this:
    gcn::TabbedArea tabs;
    tabs.setX(100);
    tabs.setY(100);
    tabs.setWidth(300);
    tabs.setHeight(300);

    gcn::Container container;
    container.setWidth(tabs.getChildrenArea().width);
    container.setHeight(tabs.getChildrenArea().height - 25);

    gcn::ScrollArea area;
    area.setX(10);
    area.setY(10);
    area.setWidth(100);
    area.setHeight(100);

    MyListModel model;
    MyListBox listbox(&model);
    listbox.setWidth(100);

    area.setContent(&listbox);

    container.add(&area);
    tabs.addTab("Start", &container);

What happens is that when trying to scroll the scrollarea the position of the 
listbox is unaffected. It doesn't scroll when pulling the scrollbar. This is 
because the position of the listbox is not applied which is done in 
ScrollArea::logic, but because that method is not called by TabbedArea it is 
not applied. My fix (listed below) fixes this issue.

Please use labels and text to provide additional information.

I have attached the fixed file. The fixed line is this:

    void TabbedArea::logic()
    {
        for (unsigned int i = 0; i < mTabs.size(); i++)
        {
            mTabs[i].second->logic();
        }
    }

Original issue reported on code.google.com by Erik.rot...@gmail.com on 22 Oct 2010 at 1:40

Attachments:

GoogleCodeExporter commented 8 years ago
Shouldn't you verify that each tab has a child before you call logic on it?

Original comment by jaxad0...@gmail.com on 22 Oct 2010 at 4:01

GoogleCodeExporter commented 8 years ago
Right, we also hit this bug in the Mana client. Probably you'll want to call 
logicChildren() instead, though.

Original comment by b.lindeijer on 22 Oct 2010 at 9:10

GoogleCodeExporter commented 8 years ago
Yes, I saw that method I posted this. Is anyone still developing guichan?

Original comment by Erik.rot...@gmail.com on 22 Oct 2010 at 10:15

GoogleCodeExporter commented 8 years ago
Not really. The main developer got busy with other things and I don't have time 
or interest either to bring the current 'master' branch towards a new 0.9.0 
release.

Of course this fix could be done on the 0.8 branch, assuming it's binary 
compatible, and released as 0.8.3, but then again you'll probably want to just 
copy Guichan into your project anyway.

Original comment by b.lindeijer on 23 Oct 2010 at 9:34