Page 1 of 1

Picture Grid

Posted: Thu Mar 17, 2005 19:09
by Darke

I'm new to CEGUI and I was looking into creating a picture 'grid' or something similar, which would essentially be a grid of several picture images from an imageSet or text-based objects. The grid would have to support a scrollbar, is selected and get selected routines, and handling mouse-based events such as double-clicking or right-clicking (this functionality already seems to be a part of the staticimage class). An optional (but very useful) feature would be the capability to drag the elements to other slots or other staticimages. The intended use is an inventory system, though this could very easily be used with text elements for calendar type applications.

After looking through the API reference for CEGUI, the only method I could find for creating such a grid with CEGUI is using several static images in a window with a grid-type background image (though I have no idea how to do the scrollbar or image dragging yet). I was wondering if there is an easier way, or if I have overlooked something else which may already allow this, since the aforementioned method seems like it would require a lot of tweaking to get it to function properly... and it seems a little much for something that's so common in many games and applications.

Thanks much

Re: Picture Grid

Posted: Thu Mar 17, 2005 19:57
by CrazyEddie
If you're on the 0.2.x line of code, then it's definately a totall roll-your-own job. If you're on HEAD (still a bit unstable, probably), then there is a DragContainer widget which offers generic drag/drop support, a ScrollablePane which could handle the scrolling aspects for you, you'd still need to implement the grid layout yourself (and obviously handle the drag/drop events) but it would be fairly simple.

Another alternative is a custom ListboxItem used with the MultiColumnList (aka Grid) widget. Though you would need to implement all your own input handling for those for the time being. Some upcoming changes will solve this deficiency also, though it's a little way off and as such is of no immediate use ;)


Re: Picture Grid

Posted: Thu Mar 17, 2005 20:17
by Darke
Thanks for the information, CE. I am using 0.2.x but I may just give the other branch a try since it sounds like it might save a lot of time.

Take care