iconlist in every container


any suggestions how to improve performance. at the moment i create an iconarray for every container. the containers have listboxes (with icons of course).

the problem here is: the listboxes own the iconarray and they are destroyed when a view (several views, each one has a container) is changed. so my iconarray would be destroyed too if there is only one iconarray.

//iList is a CEikFormattedCellListBox it takes ownership of iconList
iList->ItemDrawer()->ColumnData()->SetIconArray( iconList );
CleanupStack::Pop(iconList);  // iconList

has anybody an idea how to create ONE iconarray which can be used in all listboxes? I think that "SetIconArray()" method is the main problem here.


You can't set the ownership, but you can reset the iconlist. If you call
SetIconArray(NULL) before destroying the listbox, it won't delete the
iconlist. You just need to destroy the array manually at some point.

(if you do end up having to create multiple arrays from the same icons
for some reason, you can Duplicate() the Handle() of the bitmaps instead
of re-reading from the file. That should be a lot cheaper, as it just
increments the server-side reference count).