I have an older version of CEGUI (notsure which version, but whatever came with Ogre 1.01). I have looked at the sample that came with the version of Ogre, plus I downloaded the new release of CEGUI 0.4.1 and tried those as well and still am having a problem.
here is my code, I have tried several different methods, and still no luck, so here are a couple that I have tried:
The first is similar to I think demo 7 of the newer samples.
Code: Select all
void GameManager::enterChat(void) {
CEGUI::ListboxTextItem *listBoxItem =
new CEGUI::ListboxTextItem("Brian: " + mChatBox->getText(), mChatList->getItemCount());
const CEGUI::Image* testing = &CEGUI::ImagesetManager::getSingleton().getImageset("TaharezLook")->getImage("ListboxSelectionBrush");
listBoxItem->setSelectionBrushImage(testing);
listBoxItem->setSelected(mChatList->getItemCount() == 0);
listBoxItem->setSelectionColours(CEGUI::colour(0.0f, 0.0f, 255.0f));
mChatList->addItem(listBoxItem);
mChatBox->setText("");
mChatList->ensureItemIsVisible(listBoxItem);
}and this was using just like in demo 8 of Ogre samples:
Code: Select all
void GameManager::enterChat(void) {
CEGUI::ListboxTextItem *listBoxItem =
new CEGUI::ListboxTextItem("Brian: " + mChatBox->getText(), mChatList->getItemCount());
listBoxItem->setSelectionBrushImage((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"TextSelectionBrush");
listBoxItem->setSelected(mChatList->getItemCount() == 0);
listBoxItem->setSelectionColours(CEGUI::colour(0.0f, 0.0f, 255.0f));
mChatList->addItem(listBoxItem);
mChatBox->setText("");
mChatList->ensureItemIsVisible(listBoxItem);
}I also tried creating a brush image, like what was done in demo 8, but seeing how all it did was get the colour, I have removed that for I dun need to see it.
Another thing someone mentioned was I needed to set up an event Subscriber for EventSelectionChanged. I probably did it wrong, but I also tried that:
Code: Select all
mChatList = static_cast<CEGUI::Listbox*>(
wmgr.getWindow((CEGUI::utf8*)"Server_Select/ChatBox"));
mChatList->subscribeEvent(
CEGUI::Listbox::EventSelectionChanged,
CEGUI::Event::Subscriber(&GameManager::selectFromList, this));
mChatList->subscribeEvent(
CEGUI::Listbox::EventMouseButtonDown,
CEGUI::Event::Subscriber(&GameManager::selectFromList, this));
bool GameManager::selectFromList(const CEGUI::EventArgs& e) {
//if (mChatList->getFirstSelectedItem()->isSelected())
if (mChatList->isItemSelected(0)) {
printf("%s\n", mChatList->getText());
mChatList->getListboxItemFromIndex(0)->setSelectionBrushImage("TaharezLook", "TextSelectionBrush");
mChatList->getListboxItemFromIndex(0)->setSelected(true);
mChatList->getListboxItemFromIndex(0)->setSelectionColours(CEGUI::colour(0.0f, 0.0f, 255.0f));
}
printf("I selected an object\n");
return true;
}
cause of the printf, I know it selects the objects...but for whatever reason, it wont highlight.
I realize that I made stupid mistakes before trying the demoes, and it was usually something small and simple to fix, but I have been unable to fix this. Please someone say what dumb thing I am missing/have done wrong.
Thanks...
