autoscroll and no horiz scrollbar for Listbox
Moderators: CEGUI MVP, CEGUI Team
autoscroll and no horiz scrollbar for Listbox
I need to remove the horizontal scroll for a listbox, and scroll the text whenever I add a new text line. How can I do this?
Is this for a chat ?
This is a code snippet from my chat handling listbox. It does add a new item to the listbox (the new item being "this"), scroll the listbox down so the new item can be seen (ensureItemIsVisible) and also cares to not over-fill the listbox, else CEGUI gets very slow !! 100 is a good value for D_MAX_CHAT_ENTRIES.
In the default TaharezLook listbox, there seems to be no way to suppress the horizontal scrollbar, you will need to create your own look'n'feel file for the listbox. It's not too hard
Code: Select all
try {
LB->addItem(this);
// Care to not overfill the listbox.
while(LB->getItemCount() > D_MAX_CHAT_ENTRIES) {
LB->removeItem(LB->getListboxItemFromIndex(0));
}
LB->ensureItemIsVisible(this);
} catch(CEGUI::Exception & e) {
FTS18N("CEGUI", FTS_ERROR, e.getMessage().c_str());
}
This is a code snippet from my chat handling listbox. It does add a new item to the listbox (the new item being "this"), scroll the listbox down so the new item can be seen (ensureItemIsVisible) and also cares to not over-fill the listbox, else CEGUI gets very slow !! 100 is a good value for D_MAX_CHAT_ENTRIES.
In the default TaharezLook listbox, there seems to be no way to suppress the horizontal scrollbar, you will need to create your own look'n'feel file for the listbox. It's not too hard

- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
The 'right' way that you should be able to get it to work is by writing a customised item for the list box that has a fixed width (and that wraps the content as needed), this would ensure that there is never any need to scroll horizontally.
The 'hacky' way is to pre-process the item lines to be added, splitting them into multiple items (lines) before adding them.
The 'hacky' way is to pre-process the item lines to be added, splitting them into multiple items (lines) before adding them.
Who is online
Users browsing this forum: No registered users and 22 guests