Remove item from ListView?

Hello,

this feels like a noob question, but I am unable to remove an individual item from a list view.

I have this list view widget that shows other entry widgets. These entry widget represent actors in the world that have a timer on them. And when that timer reaches 0, I want to remove the corresponding entry widget from the list.

At the moment I have the entry widget listen to their actor’s countdown and then request removal:

And this is what it looks like on the ListView itself:

The logic goes through, as the Print String is triggered, but the entry in the list is not removed.

I have tried:

  • Refreshing the List after removal
  • Converting the List to an array before removing
  • With several entries in the list

Nothing worked. “Clear Items” does work though. I’m guessing there is something I do not understand with ListViews, but I’ve been searching the internet and can’t find an answer.

1 Like

It seems ListView is broken in 5.0 and 5.1:

I made a simple test, and it works with TileView and doesn’t work with ListView:


RemoveRandomItem

With list view, I got the following warning in the log:

image

RemoveRandomItemДшыеМшуц

GetListItems returns an empty array.
GetNumItems returns 5,
GetItemAt returns a valid object

UPDATE:
It works if I keep an array of items as a variable:


RemoveLastItem

I see, thank you!

I’ve tried your solution, can’t make it work yet, but I’ll persist. In the meantime, is there a way I could report this to make sure it is fixed in a next version?

Thank you again :slight_smile: I have reported the issue.