Console with MultiLineEditbox or ListBox?

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

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

Console with MultiLineEditbox or ListBox?

Postby VitaliBR » 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:

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? :?

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

Re: Console with MultiLineEditbox or ListBox?

Postby Jamarr » Wed Nov 03, 2010 20:00

You can already find the answer to this question by 1) Reviewing the samples (CEGUI\Samples folder) provided with the SDK or 2) searching the forum, wiki, and google or 3) reviewing the API. I know this is the Beginners Help forum, but please, at least attempt to find the answer on your own before wasting someone else's time with trivial questions. The purposes of a MultiLineEditbox and a Listbox are vastly different. A MLE holds a single, multi-line string; a LB holds ListboxItems. Setting the text property of a LB makes no sense.
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!


Return to “Help”

Who is online

Users browsing this forum: No registered users and 11 guests