[SOLVED] TextListItems not showing

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

daves
Home away from home
Home away from home
Posts: 253
Joined: Thu Feb 02, 2006 20:12

[SOLVED] TextListItems not showing

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

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));
Last edited by daves on Thu Jun 21, 2007 18:31, edited 1 time in total.

daves
Home away from home
Home away from home
Posts: 253
Joined: Thu Feb 02, 2006 20:12

Postby daves » Thu Jun 21, 2007 16:28

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


Return to “Help”

Who is online

Users browsing this forum: No registered users and 27 guests