Console with MultiLineEditbox or ListBox?
Posted: Wed Nov 03, 2010 17:43
I searched about and found this:
viewtopic.php?f=10&t=4358
But I have a problem,
using MultiLineEditbox:
It's working perfectly
But when I try to use ListBox does not work (the string does not appear in the ListBox):
Why?
viewtopic.php?f=10&t=4358
But I have a problem,
using MultiLineEditbox:
Code: Select all
CEGUI::Editbox* input = static_cast<CEGUI::Editbox*>(CEGUI::WindowManager::getSingletonPtr()->getWindow("root/Console/input"));
input->subscribeEvent(CEGUI::Editbox::EventTextAccepted, CEGUI::Event::Subscriber(&MenuState::CEGUI_onTextAccepted, this));
bool MenuState::CEGUI_onTextAccepted(const CEGUI::EventArgs &e)
{
// Our text has been accepted by either deactivating it or pressing tab or enter.
CEGUI::Editbox * editBox = static_cast<CEGUI::Editbox*>(CEGUI::WindowManager::getSingletonPtr()->getWindow("root/Console/input"));
CEGUI::MultiLineEditbox * multiLineEditbox = static_cast<CEGUI::MultiLineEditbox*>(CEGUI::WindowManager::getSingletonPtr()->getWindow("root/Console/text_info"));
multiLineEditbox->setText(editBox->getText());
return true;
}
It's working perfectly
But when I try to use ListBox does not work (the string does not appear in the ListBox):
Code: Select all
CEGUI::Editbox* input = static_cast<CEGUI::Editbox*>(CEGUI::WindowManager::getSingletonPtr()->getWindow("root/Console/input"));
input->subscribeEvent(CEGUI::Editbox::EventTextAccepted, CEGUI::Event::Subscriber(&MenuState::CEGUI_onTextAccepted, this));
bool MenuState::CEGUI_onTextAccepted(const CEGUI::EventArgs &e)
{
// Our text has been accepted by either deactivating it or pressing tab or enter.
CEGUI::Editbox * editBox = static_cast<CEGUI::Editbox*>(CEGUI::WindowManager::getSingletonPtr()->getWindow("root/Console/input"));
CEGUI::Listbox * text_info = static_cast<CEGUI::Listbox*>(CEGUI::WindowManager::getSingletonPtr()->getWindow("root/Console/text_info"));
text_info->setText(editBox->getText());
return true;
}
Why?