[SOLVED] TextListItems not showing
Posted: Thu Jun 21, 2007 14:47
I'm trying to create a list box with 3 text elements in it. The list box shows up... but the text items do not.
The following is the section of code that creates the listbox:
In the following image you see the empty white list box (as well as some buttons and other windows):
What am I missing?
------------------------------
Answer I'm missing three things:
1] Dont know why editing the looknfeel didnt work (o well)
2] Seems that different cegui widget have a different default color (hard-coded internally - some are black some are white)
3] Following line works gets me past #'s 1 and 2 above:
listboxItem->setTextColours(CEGUI::colour(1.0, 1.0, 0.0, 1.0), CEGUI::colour(1.0, 1.0, 0.0, 1.0), CEGUI::colour(1.0, 1.0, 0.0, 1.0), CEGUI::colour(1.0, 1.0, 0.0, 1.0));
The following is the section of code that creates the listbox:
Code: Select all
mFilenameListbox = static_cast<CEGUI::Listbox*>(mWinMgr->createWindow("WindowsLook/Listbox", "PlaybackMenuFilenameListbox"));
mFilenameListbox->setMultiselectEnabled(false);
assert(mFilenameListbox && "PlaybackMenu::show: Failed to create listbox");
mFilenameListbox->setText("Hello");
CEGUI::ListboxItem *listboxItem = new CEGUI::ListboxTextItem("ysadjfkasjdfkasjfdkjk", 1);
mFilenameListbox->addItem(listboxItem);
listboxItem = new CEGUI::ListboxTextItem("ho ho ho", 2);
mFilenameListbox->addItem(listboxItem);
listboxItem = new CEGUI::ListboxTextItem("mo mo mo", 3);
mFilenameListbox->addItem(listboxItem);
mFilenameListbox->ensureItemIsVisible(listboxItem);
mFilenameListbox->setArea(CEGUI::URect(CEGUI::UDim(0.0, 10), CEGUI::UDim(0.0, 10), CEGUI::UDim(0.5, 0.0), CEGUI::UDim(0.25, 0.0)));
mFilenameListbox->setItemSelectState((std::size_t) 1, true);
mFrame->addChildWindow(mFilenameListbox);
In the following image you see the empty white list box (as well as some buttons and other windows):

What am I missing?
------------------------------
Answer I'm missing three things:
1] Dont know why editing the looknfeel didnt work (o well)
2] Seems that different cegui widget have a different default color (hard-coded internally - some are black some are white)
3] Following line works gets me past #'s 1 and 2 above:
listboxItem->setTextColours(CEGUI::colour(1.0, 1.0, 0.0, 1.0), CEGUI::colour(1.0, 1.0, 0.0, 1.0), CEGUI::colour(1.0, 1.0, 0.0, 1.0), CEGUI::colour(1.0, 1.0, 0.0, 1.0));