setAutoScrollEnabled() bug?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
BraX
Posts: 36
Joined: Fri Jul 16, 2010 4:39 pm

setAutoScrollEnabled() bug?

Post by BraX »

Okey, so i've made in-game console for my game, text area is coded here:

Code: Select all

        m_iID_BG = env->addListBox(core::rect<s32>(0, 0, size.Width, 320-150));
        m_iID_BG->setDrawBackground(true);
        m_iID_BG->setAutoScrollEnabled(true);
        m_iID_BG->setVisible(m_bActive);
To enter text im using:

Code: Select all

m_iID_BG->addItem( text );
The problem is that ListBox is not scrolling down automatically when there's more text.
I've tried milion ways but i cant solve my problem.

Here's what i see:
Image

And here's what should i see:
Image



I hope that someone will help me with this problem.
CuteAlien
Admin
Posts: 9933
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: setAutoScrollEnabled() bug?

Post by CuteAlien »

It scrolls to selected items, not to added items. When you set the selection always to the last item it will scroll to that.

Code: Select all

 
myListBox->setSelected( myListBox->getItemCount()-1 );
 
If you don't want to change selection it's a little more tricky right now. Basically you would still call setSelected, but could reset it to old values (or -1) afterward with autoscroll disabled.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
BraX
Posts: 36
Joined: Fri Jul 16, 2010 4:39 pm

Re: setAutoScrollEnabled() bug?

Post by BraX »

Thanks for help :)
Post Reply