on 01-05-2012 10:32 PM
What is the recommended method of removing ListPanelItems from a GridListPanel or ListPanel,
or indeed to clear all items from a GridListPanel / ListPanel
A loop calling Dispose() on the child items doesn't seem to work
I've also tried setting ItemCount=0 and then calling StartItemRequest() but to no avail
on 02-05-2012 11:40 AM
You can't use an item iterator if you want to clear items from a list. You need to access them by index.
This is what I use:
List<Sce.Pss.HighLevel.UI.Widget> deleteChildren = new List<Sce.Pss.HighLevel.UI.Widget>();
foreach(Sce.Pss.HighLevel.UI.Widget child in this.Children)
There may still be a better way, but this works well.
If you want to have a very fast clear all, I'd recommend Disposing the parent panel that contains the items and creating it fresh, probably faster. One of the panels I throw away with the code above also contains several child elements, and that's no problem.
Website ©2013 Sony Computer Entertainment Europe
All content, game titles, trade names and/or trade dress, trademarks, artwork and associated imagery are trademarks and/or copyright material of their respective owners. All rights reserved. [more info]