Listbox going bottom top

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

cacau
Just popping in
Just popping in
Posts: 3
Joined: Wed Nov 03, 2010 18:02

Listbox going bottom top

Postby cacau » Wed Nov 03, 2010 18:22

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

VitaliBR
Not too shy to talk
Not too shy to talk
Posts: 25
Joined: Mon Oct 18, 2010 02:28

Re: Listbox going bottom top

Postby VitaliBR » Wed Nov 03, 2010 18:39

I would also like to know :D

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: Listbox going bottom top

Postby Jamarr » Wed Nov 03, 2010 20:16

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.
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

cacau
Just popping in
Just popping in
Posts: 3
Joined: Wed Nov 03, 2010 18:02

Re: Listbox going bottom top

Postby cacau » Wed Nov 03, 2010 20:24

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

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: Listbox going bottom top

Postby Jamarr » Wed Nov 03, 2010 22:10

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.
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

cacau
Just popping in
Just popping in
Posts: 3
Joined: Wed Nov 03, 2010 18:02

Re: Listbox going bottom top

Postby cacau » Wed Nov 03, 2010 22:49

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


Return to “Help”

Who is online

Users browsing this forum: No registered users and 10 guests