Page 1 of 1

Deallocation handled by Listbox?

Posted: Sat Jan 30, 2010 15:35
by wizzler
Hey.

I found this snippet that i've modified on the wiki and i was wondering if the heap allocation is later handled by the listbox?

Code: Select all

CEGUI::String text("test");
ListboxTextItem* item = new ListboxTextItem(text);
Listbox* chatBox = static_cast<Listbox*>(CEGUI::WindowManager::getSingletonPtr()->getWindow("/ChatBox/List"));
chatBox->addItem(item);


Is there another, perhaps proper way of doing this?

Re: Deallocation handled by Listbox?

Posted: Sat Jan 30, 2010 18:25
by CrazyEddie
Hi,

Using the approach you have at the moment, the items will automatically be deleted by the Listbox.

HTH

CE.

Re: Deallocation handled by Listbox?

Posted: Sat Jan 30, 2010 22:46
by wizzler
CrazyEddie wrote:Hi,

Using the approach you have at the moment, the items will automatically be deleted by the Listbox.

HTH

CE.


sounds great! thanks for the reply.