Page 1 of 1

Confusion with Demo7 ItemListBox

Posted: Mon Nov 13, 2006 20:40
by dteviot
Hi Guys,
I'm not quite sure where I should post this, so if this is the wrong place, I apologise.
Anyway, looking at the sample code for the 0.5.0 release. Demo 7 replaces the ListBox widget with the ItemListBox. However, in the scheme file
/samples/datafiles/schemes/TaharesLook.scheme it defines this type to represent the "items" in the list box:
<FalagardMapping WindowType="TaharezLook/ListboxItem" TargetType="CEGUI/ItemEntry" Renderer="Falagard/ItemEntry" LookNFeel="TaharezLook/ListboxItem" />
The problem is that "ListboxItem" is the name of the CEGUI class that represents an item in the depreciated ListBox class. Consequently, this sample code is confusing for someone who looks at it.

Might I suggest that TaharezLook/ListboxItem be renamed to TaharezLook/ItemEntry?
This would require updating TaharesLook.scheme and /samples/datafiles/layouts/Demo7Windows.layout

Posted: Tue Nov 14, 2006 09:28
by CrazyEddie
Hi,

Thanks for the feedback. I can see how some confusion is possible, though here are my reasonings for leaving as-is:

* One is a C++ class and the other is a 'pseudo object' that doesn't really exist.
* One is named "ListboxItem", the other "TaharezLook/ListboxItem".
* The old ListboxItem is a low-level object that you have to 'new' to create, the new types are Window based objects which get created via WindowManager.
* The new system can be used in XML layouts, the old one can not (so no confusion between the two there).
* The old system is to be deprecated and eventually removed (maybe even in 0.6.0).
* Now we've released it, changing it in the next 0.5.x release would be a breaking change, and the old system may be removed by the time 0.6.0 is ready.

We could, however, add the other mapping entry or an alias so that the suggested "TaharezLook/ItemEntry" name was available, although that could confuse people also (I imagine a raft of questions about what the difference between the two are ;) ).

CE.

Posted: Sun Apr 15, 2007 04:19
by some_name
Hmm. The documentation for CEGUI::Listbox does not claim that it is deprecated -- and I assume that CEGUI::Listbox is what gets created when the XML file says "TaharezLook/Listbox".

So, how do I, from code, add items to a TaharezLook/Listbox? There's no good documentation for this that I can find. My guess is that I get the Window of that TL/L and static_cast it to CEGUI::Listbox, and then a "new" a CEGUI::ListboxItem and call addItem() on the Listbox. Is that correct?

If not, what do I do? Do I go through WindowManager::createWindow() using a class name of "TaharezLook/ListboxItem" ?

Posted: Sun Apr 15, 2007 22:44
by Pompei2
some_name wrote:So, how do I, from code, add items to a TaharezLook/Listbox? There's no good documentation for this that I can find. My guess is that I get the Window of that TL/L and static_cast it to CEGUI::Listbox, and then a "new" a CEGUI::ListboxItem and call addItem() on the Listbox. Is that correct?

Sounds correct, tough I don't remember where I did learn/see how to do it, you could take a look at the CEGUI samples.