Why can a member variable be empty in a blueprint event ?

OP is using the List View widget which provides a special interface. It’s called when the list view generates entries from data objects.


When using the “Event On List Item Object Set”, the self referenced variable is empty whilst the reference to the same object given by the event does have the variable set.

This is normal and fine, Self is the Widget, your data is in the List View Object. See if this clarifies things a bit.

  • there is a List View widget that holds a bunch of Objects that have your data
  • when the List View instantiates an entry widget, we must pull the data out of the Object via the interface and apply it to widget fields (here, text)
  • in order to get to the data, you must Cast to the correct type to get access (or use another interface which I shamelessly have done in the past… :innocent: )

Also, consider using OnInitialise instead of Construct to add Items. You can also expose variables on the object:

image

So you can more easily pipe the data in:

image

Not really important, but convenient!


On a side note, who is keeping track of my constructed memory and who is responsible to clear these ? I only see the typical “constructs” in blueprint, but what about memory management and their “delete” or “free” calls ?

As mentioned in the previous post, there is no explicit way to release widgets from memory in BPs. The Garbage Collection will take care of it automatically, you can also force it. If you fully dereference the widget that holds onto the ListView, the object (and entry widgets, too!) will be destroyed eventually. It may take a minute since the GC runs a schedule and batch-removes stuff.


And one more thing, this setup does not make much sense from the List View’s use case point of view:

To work with a list view you need:

  • objects with data
  • user widget entries to visualise objects’ data
  • a user widget that holds the list view who then generates the entries

Here’s a minimalistic setup.

2 Likes