Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
monkeycracks
Posts: 1029 Joined: Thu Apr 06, 2006 12:45 am
Location: Tennesee, USA
Contact:
Post
by monkeycracks » Sun Mar 04, 2007 2:14 am
CGUIListBox.cpp
In both the addItem();'s right before it return's do this :
Code: Select all
if(AutoScroll == true){
ScrollBar->setPos(ScrollBar->getPos()+Font->getDimension(L"A").Height + 4);}
Add this somewhere :
Code: Select all
bool CGUIListBox::setAutoScrolling(bool autoScroll)
{
AutoScroll = autoScroll;
}
CGUIListBox.H
In the public:
Code: Select all
virtual bool setAutoScrolling(bool autoScroll);
In the private:
IGUIListBox.H
Code: Select all
virtual bool setAutoScrolling(bool autoScroll) = 0;
Also, in the constructor for CGUIListBox you can set AutoScroll to be false or true by default.
Now you've got autoscrolling listboxes when you add the items.
Last edited by
monkeycracks on Sun Mar 04, 2007 8:34 am, edited 1 time in total.
Midnight
Posts: 1772 Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland
Post
by Midnight » Mon Mar 05, 2007 2:51 am
gui is in the process of being rewritten entirly.
there are easier ways without recompiling the engine also.
Code: Select all
list<gui::IGUIElement*>::Iterator it = Console->getChildren().getLast();
gui::IGUIScrollBar* scrollbar = static_cast<gui::IGUIScrollBar*>(*it);
scrollbar->setPos(0x7FFFFFFF);
MickeyKnox
Posts: 58 Joined: Tue Apr 10, 2007 7:49 pm
Location: Karlsruhe
Post
by MickeyKnox » Fri Feb 01, 2008 1:00 pm
hm.. This thread is a little old, but it seems to be the right one for my question.
I observed, that autoscrolling was added to the new release of the engine.
Unfortunately, it does just nothing.
What am i missing?
I keep just adding items to the listbox, but the scrollbar stays always on top.
monkeycracks
Posts: 1029 Joined: Thu Apr 06, 2006 12:45 am
Location: Tennesee, USA
Contact:
Post
by monkeycracks » Sun Feb 03, 2008 6:39 pm
Sorry it took so long to respond, I've been shunning the Irrlicht forums lately. Try implementing the older method above, and if it gives you problems I'll look into it more, but that method worked for me.
MickeyKnox
Posts: 58 Joined: Tue Apr 10, 2007 7:49 pm
Location: Karlsruhe
Post
by MickeyKnox » Fri Feb 08, 2008 3:04 pm
I hacked midnights method in my code rightnow, it works.
I had to use the ConstIterator to avoid compiler errors, thought.
Nevertheless, a look in the API suggests, that autoscrolling was already
added. But calling setAutoScrollEnabled(true) has no effect for me.
hollowi
Posts: 1 Joined: Tue Sep 02, 2008 3:28 am
Post
by hollowi » Tue Sep 02, 2008 4:11 am
if( event.GUIEvent.EventType == irr::gui::EGET_EDITBOX_ENTER )
{
switch(event.GUIEvent.Caller->getID()
{
case GUIID_LOBBY_EDT_CHAT:
// something add..
pListbox->addItem(L"ChatMsg");
// get current itemcount.
pListbox->setSelected(pListbox->getItemCount());
}
}
selected last item of the Listbox,
as a result the scrollbar stays on bottom.