Game Development Community

Scrolling list of bitmap buttons

by Ronald J Nelson · in Torque Game Engine · 02/27/2008 (10:21 pm) · 3 replies

I wanted to see if this had been done yet? I wanted to be able to make a scrolling list of gui elements other than just text lists. I wanted to make a scrolling list of bitmap buttons.

I just wanted to see if someone had already done this or if it is already possible. My experiments haven't been successful thus far and I want to avoid reinventing the wheel.

#1
02/28/2008 (10:24 pm)
IS it possible to add stacked gui cntrls like buttons to a regular scroll control and actually make it scroll? I know that you can add them, but my experiences has been that it won't scroll or even act as if it needs to.
#2
02/29/2008 (1:59 pm)
YES! I have done this!

add a GuiScrollCtrl. Right click it, add a guiBitmapCtrl (this adds the bitmap INSIDE the scroller). assign the bitmap control a BLANK image (i use a 2x2 completely transparent png i call 'blank.png'). NAME the bitmap something like "scroller" or "button list".

Now, make your buttons and add them to the blank "scroller" item you made.

That's it!!

If you are wanting to dynamically add buttons to the list and remove buttons from the list, all while "playing" your program, I can go into how to do all that too since I literally just finished setting up a "shopping cart" in a program I made last week that happens to deal with buttons being added to a scrollable list and needing to be removed as well. It's actually more complicated than you might think, but still pretty easy once you know what to do.

Let me know and I can even post my code here for how I did it.
#3
02/29/2008 (2:12 pm)
Thanks a ton, its so simple I feel like an idiot for not seeing that the scroll control only accepts one child but that child can have several children.