http://www.cegui.org.uk/wiki/index.php/ ... istboxItem
so my constructor looks like this:
Code: Select all
CEGUI_DEFINE_WINDOW_FACTORY(CheckListboxItem)
const String CheckListboxItem::WidgetTypeName("CEGUI/CheckListboxItem");
CheckListboxItem::CheckListboxItem(const String &type, const String &name) :
ItemEntry(type, name)
{
int i = 0;
}
For some reason I see the ItemEntry constructor being invoked but not that of my custom widget.
at the application level I register the custom factory as follows:
Code: Select all
CEGUI::WindowFactoryManager& wfMgr = CEGUI::WindowFactoryManager::getSingleton();
wfMgr.addFactory(&CEGUI_WINDOW_FACTORY(CheckListboxItem));
wfMgr.addFalagardWindowMapping("WindowsLook/CheckListboxItem", "CEGUI/ItemEntry", "WindowsLook/CheckListboxItem", "Falagard/ItemEntry");
and then instantiate the widget as follows:
Code: Select all
CEGUI::CheckListboxItem * check = (CEGUI::CheckListboxItem*)wmgr.createWindow("WindowsLook/CheckListboxItem", "ckb");
I assumed that the constructor was being invoked because when I run my app I see a box containing a text item with a checkbox to the left of it. I assumed that because I saw the checkbox that the constructor must be called. But I'm thinking now that I see the checkbox next to the list item because of the looknfeel specification of the custom widget.
Why is my constructor not being called in direct response to the "createWindow"?
Edited with the following finding:
Hmm its the following call:
Code: Select all
wfMgr.addFalagardWindowMapping("WindowsLook/CheckListboxItem", "CEGUI/ItemEntry", "WindowsLook/CheckListboxItem", "Falagard/ItemEntry");
If I change it to this
Code: Select all
wfMgr.addFalagardWindowMapping("WindowsLook/CheckListboxItem", "CEGUI/CheckListboxItem", "WindowsLook/CheckListboxItem", "Falagard/ItemEntry");
then my constructor is called. Is one of these two methods wrong, or are they both reasonable depending on the nature of the custom widget?

