Problem with empty method of multilineeditbox->gettext()
Posted: Sat Jun 23, 2007 22:01
Hi there,
I have written a simple chat, and i want to check if the written string in the multilineeditbox is empty or not. The empty strings shouldn`t be add to the listbox. the problem is the call of editbox->getText().empty() everytime gives false and the written string is always add to the listbox, even if it is empty. How can i change my code (see below) to make it right?
Thanks for help.
I have written a simple chat, and i want to check if the written string in the multilineeditbox is empty or not. The empty strings shouldn`t be add to the listbox. the problem is the call of editbox->getText().empty() everytime gives false and the written string is always add to the listbox, even if it is empty. How can i change my code (see below) to make it right?
Code: Select all
CEGUI::ListboxTextItem* item;
//Check if text is empty
if(editbox->getText().empty() == true){
editbox->setText("");
return false;
}
//add text to the listbox
else
item = new CEGUI::ListboxTextItem(editbox->getText());
listbox->addItem ( item );
listbox->ensureItemIsVisible(listbox->getItemCount());
//Clean the multilineeditbox
editbox->setText("");
return true;
Thanks for help.