This, from what I understood, passes a reference of the actual item being draw to… somewhere. Some instance of the item I have no idea where, but it works until here. If I do this:
What I think it should happen is: I get a reference to the item that I saved and actually worked before and try to modify it, but nothing happens. The print doesn’t even fire, not even an error.
So I just realized I have no idea where the items are actually stored and where I can go to change their properties, or if I even can do it. I can work around my problem if I put some item in the widget and work around the problem, but I think I need to understand exactly how this list works.
It seems to me that you need to use an array here. If not, you are getting the ref to the last added widget only.
Here is a quick guide : Blueprint Arrays | Unreal Engine Documentation
Yes, I see them and if I use the Event OnListItemObjectSet I can actually change their properties, but after that everything is lost into a limbo of objects.
You don’t add those widgets to a dedicated array but they should be accessible with the “get list items” you are using.
What if you print the length of this array? Does it give you the correct number?
These are the 5 items in the List. In my head they should be 100% working, makes no sense. If I print the name of the items on the event that actually passes a valid reference, they have the same name.
Maybe that could worth it to use a dedicated array. When you create the item widget and add it to the list view, add it to a ItemWidget array as well, and use this array instead
If I read the screenshots correctly you are adding ItemWidgets which are Widget Blueprints themselves. I don’t think that’s what you should normally be doing, the whole point of the ListView widget is that it only creates as many widgets of the configured Widget Class as necessary. Creating a widget for each item in the list anyway kind of works against that. Typical uses of ListView have two classes (plus the widget that contains the ListView). One containing the actual item data. And the other one that implements the UI for a single element and implements the UserObjectListEntry interface. The OnListItemObjectSet function holds a reference to an instance of the actual item data in its ListItemObject parameter.
So basically what may be happening is that you create Widgets that represent the item data and then the ListView creates additional Widgets that it actually uses to display those items.
God in heaven, thanks for the advice! I hacked my brain for 12 hours trying to understand all this, but I finally got it after seeing how the list is actually implemented in c++. They get an actual object that is not specified beforehand (I think any UObject may fit) and makes a widget for it. I could actually navigate the nodes after knowing that and what the references are for. Thank you again, brother!
What’s happening is that list view items are not always there.
They are dynamically added and removed. When in view, it will be added and the widget properties will be able to work.
Even if you had all of the widgets showing, you cannot access them as regular objects but as objects displayed by the listview container.
So let’s say you have 200 items.
If you show 5, only those 5 are represented and have available properties.
When you scroll, whatever is off screen is removed and a new item is added to the displayed list.
I wish there was an easier way to interact with this but the true way to do so is to use a list view manager that keeps track of every item that is added/removed and once you add/remove them, you use that same manager to manage the properties; essentially making the listview just a visual cosmetic that accompanies the manager.