Page 1 of 1

[SOLVED] TextListItems not showing

Posted: Thu Jun 21, 2007 14:47
by daves
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:

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

Image

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));

Posted: Thu Jun 21, 2007 16:28
by daves
it seems as if the text is showing up as "white" tho in the looknfeel TextColour is set to black:

    <WidgetLook name="WindowsLook/ListboxItem">
    <PropertyDefinition name="TextColour" initialValue="FF000000" redrawOnWrite="true" />
    <PropertyDefinition name="SelectedTextColour" initialValue="FF00FFFF" redrawOnWrite="true" />
    <PropertyDefinition name="SelectionBrush" initialValue="set:WindowsLook image:Background" redrawOnWrite="true" />
    <PropertyDefinition name="SelectionColour" initialValue="FF3030FF" redrawOnWrite="true" />


when i change the colors in this looknfeel there seems to be no effect on the rendered listbox and listboxitems

The text shows up if i put the following line in:

Code: Select all

   listboxItem->setSelectionBrushImage("WindowsLook", "Background");