Confusion with Demo7 ItemListBox

If you found a bug in our library or on our website, please report it in this section. In this forum you can also make concrete suggestions or feature requests.

Moderators: CEGUI MVP, CEGUI Team

dteviot
Just popping in
Just popping in
Posts: 15
Joined: Mon Nov 13, 2006 19:26

Confusion with Demo7 ItemListBox

Postby dteviot » Mon Nov 13, 2006 20:40

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

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Tue Nov 14, 2006 09:28

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.

some_name
Just popping in
Just popping in
Posts: 15
Joined: Sat Mar 10, 2007 00:12

Postby some_name » Sun Apr 15, 2007 04:19

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" ?

Pompei2
Home away from home
Home away from home
Posts: 489
Joined: Tue May 23, 2006 16:31

Postby Pompei2 » Sun Apr 15, 2007 22:44

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.


Return to “Bug Reports, Suggestions, Feature Requests”

Who is online

Users browsing this forum: No registered users and 1 guest