I have a layout that's loaded from a .layout file. It contains a TaharezLook/Listbox class. I want to add text items to this listbox (based on listing files in a directory).
However, I believe I'm doing the right thing, but I can't get the list box to actually draw the items I add.
Here's the function I call to add text items:
Code: Select all
void AddListboxItem(char const *name, char const *item)
{
static int itemId;
WidgetMap::iterator ptr = widgets_.find(name);
if (ptr == widgets_.end()) return;
CEGUI::String const &s = (*ptr).second->getType();
if ((*ptr).second->getType() != CEGUI::String("TaharezLook/Listbox")) return;
static_cast<CEGUI::Listbox *>((*ptr).second)->addItem(new CEGUI::ListboxTextItem(item, ++itemId));
static_cast<CEGUI::Listbox *>((*ptr).second)->handleUpdatedItemData();
}
I understand that handleUpdatedItemData() is not needed, but I added it in a fit of desperation.
Here's the XML I use to create the listbox:
Code: Select all
<Window Type="TaharezLook/Listbox" Name="LevelNameSelection">
<Property Name="UnifiedPosition" Value="{{0.05,0},{0.20,0}}" />
<Property Name="UnifiedSize" Value="{{0.9,0},{0.65,0}}" />
<Property Name="Text" Value="Level To Edit" />
<Property Name="SortEnabled" Value="True" />
<Property Name="MultiselectEnabled" Value="False" />
<Property Name="VertScrollbarAlwaysShown" Value="True" />
</Window>
What am I doing wrong? What do I need to check?