Page 1 of 1

Use MyGUI ItemBox

Posted: Fri Dec 23, 2016 6:05 pm
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.

Re: Use MyGUI ItemBox

Posted: Sat Jan 14, 2017 11:39 am
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.