Page 1 of 1
Listbox going bottom top
Posted: Wed Nov 03, 2010 18:22
by cacau
Hi,
I need to implement a dialog message box in my game, and I'm using Listbox to do that. By design, this dialog should add new messages at the bottom of the list (as it usual does) but move all the previous messages (items) one position up when added. Is there any easy way to implement that behavior, so my Listbox was aligned to the bottom, with the last added item at the very bottom and the first added at the very top?
Thank you
Re: Listbox going bottom top
Posted: Wed Nov 03, 2010 18:39
by VitaliBR
I would also like to know
Re: Listbox going bottom top
Posted: Wed Nov 03, 2010 20:16
by Jamarr
What have you tried? Did you bother to look at the API of the Listbox object before posting? Both the old, deprecated
Listbox and the newer
ItemListbox interfaces provide an
insertItem method. You can use this method to insert items in arbitrary positions.
Re: Listbox going bottom top
Posted: Wed Nov 03, 2010 20:24
by cacau
No absolutely, I don't bother to look at the API. And a looked a lot before posting here. I think I wasn't able to express my problem correctly to you, Sir.
The question that I was not able to solve, is creating a List that grows up vertically in the upper direction, keeping the new item at the bottom. It's like a stack where you add new objects from the bottom not on top. I'm really sorry if this is something clear in the API, but my ignorance was not able to figure this out from it.
Thank you
Re: Listbox going bottom top
Posted: Wed Nov 03, 2010 22:10
by Jamarr
As I said, depending on which Listbox you are using, you can use the CEGUI::Listbox::insertItem or CEGUI::ItemListbox::insertItem method to add items to the list arbitrarily. In other words, you can add items to the bottom of the list; after you add the item, scroll it into view, and then you seemingly have a listbox that grows up. If you are looking for an explicit block of code to copy/paste, I cannot provide that.
Re: Listbox going bottom top
Posted: Wed Nov 03, 2010 22:49
by cacau
Thank you again Jamarr, I really don't need a chunk of code to copy and paste. I just need an insight of how to code in the best way and you just gave me that!
best wishes