Widget Exposed Variable Fails to Capture Value Which Is Set During Construction

Hi, I am new to UE, and struggling with probably a very basic thing.

I am trying to pass a texture parameter to the constructed widget which is supposed to be displayed as image:

image

I did bind the variable to the image input by creating a brush from the texture:


Setting the exposed parameter does not help at all, only if I set a default value it is working. What am I missing?

Call SetBrushFromTexture by EventConstruct, and remove the binding.

Thanks for the answer @PREDALIEN.

Still doesn’t seem to be working.

I am constructing my widget with the red devil icon, and I am setting the texture as you said (with binding removed), yet I am still seeing the green icon, which is the default value of the texture:

This doesn’t make a single sense to me. My UE version is 5.4

I am constructing my widget

This is a List View and that’s not how they work, you never add widgets to list views directly. You add data objects instead and the list view instantiates the widgets for you. Better have a look at a List View tutorial.


A crude random crash course example:

2 Likes

Right, I already forgot how List View works… :expressionless:

By the way, have you checked how List View will behave if you make a dynamic item class, a kind of wrapper, and the item widget itself will be created inside it based on the class that will be passed when adding the item?
Will this break all List View optimizations, or was this use case intended?

I’ve never tried it! But how would that work, how would you wrap it? Some Named Slot shenanigans? Have the LV instantiate a basic widget with a Named Slot, create a user widget and insert it into the Slot? This way the LV should take it all down - could work.

Item Object contains the widget class that is created inside the item widget by EventConstruct.

Thank you @Everynone and @PREDALIEN

The solution was to create a blueprint which is containing the data and to implement the OnListItemObjectSet in the widget entry:

I really appreciate the help!