Use MyGUI ItemBox

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
andrew_vorobey
Gnoblar
Posts: 5
Joined: Sat Aug 20, 2016 3:21 pm

Use MyGUI ItemBox

Post by andrew_vorobey »

I would like to use ItemBox to show Images. But I don't know how to make it right.
The ItemBox from demo is very hard: there are many classes for this easy thing.
I've crated ItemBox(I see it on the screen). And I would like to add ImageBox on it.

In follow code i is a for-loop variable

Code: Select all

        
        auto item = new MyGUI::ImageBox();
        item->setImageTexture("photo.png");
        itemBox->insertItemAt(i,item);
But the ItemBox is empty.

I've tried to create item like this:

Code: Select all

        auto item = itemBox->createWidget<MyGUI::ImageBox>("ImageBox",
                                                             itemBox->getHeight() * i,0,
                                                             itemBox->getHeight() / 2,itemBox->getHeight() / 2,
                                                             MyGUI::Align::Default, "");
Now it's shows elements, but on the itembox, not in. There is no scroll bar and the itembox doesn't set them grid positions.
User avatar
altren
Gnome
Posts: 334
Joined: Tue Oct 24, 2006 9:02 am
Location: Moscow, Russa
x 26

Re: Use MyGUI ItemBox

Post by altren »

You should use this sample as simple reference: https://github.com/MyGUI/mygui/blob/mas ... Keeper.cpp
Basically what you need is to set callbacks for Item creation/redraw and other events.

Also use MyGUI subforum next time.
Image