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

**URL:** <https://forums.unrealengine.com/t/widget-exposed-variable-fails-to-capture-value-which-is-set-during-construction/2018028>\
**Category:** UI\
**Tags:** unreal-engine, question\
**Created:** [September 12, 2024, 5:14pm UTC](https://forums.unrealengine.com/t/widget-exposed-variable-fails-to-capture-value-which-is-set-during-construction/2018028 "2024-09-12T17:14:50Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Denomee](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Denomee](https://forums.unrealengine.com/u/Denomee)\
**Post date:** [September 12, 2024, 5:14pm UTC](https://forums.unrealengine.com/t/widget-exposed-variable-fails-to-capture-value-which-is-set-during-construction/2018028/1 "2024-09-12T17:14:50Z")

</div>

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

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/c/1/ec1a5b49a5ca0a2837ee3940c1ae7274911a0ba2.png)

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

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/1/6/f16b08bc9abc7f1a71e20ed720cbdd33ab5d4b44.png)

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

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/6/f/c6f5f567cfdcb1a6a2b9c7f214f1b95c3490f16a.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/2/4/524868b804cacc6a64a93b3937bf9ea201e888ac.png)

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

---

<div class="post-metadata">

**Author:** ![PREDALIEN](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/predalien/32/1194670_2.png) [@PREDALIEN](https://forums.unrealengine.com/u/PREDALIEN)\
**Post date:** [September 12, 2024, 11:17pm UTC](https://forums.unrealengine.com/t/widget-exposed-variable-fails-to-capture-value-which-is-set-during-construction/2018028/2 "2024-09-12T23:17:21Z")

</div>

Call SetBrushFromTexture by EventConstruct, and remove the binding.

---

<div class="post-metadata">

**Author:** ![Denomee](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Denomee](https://forums.unrealengine.com/u/Denomee)\
**Post date:** [September 13, 2024, 8:10am UTC](https://forums.unrealengine.com/t/widget-exposed-variable-fails-to-capture-value-which-is-set-during-construction/2018028/3 "2024-09-13T08:10:51Z")

</div>

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:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/c/8/8c890aa6b6b3ebfc72d3e7492dbb8f23108ea8ba.png)

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

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [September 13, 2024, 8:26am UTC](https://forums.unrealengine.com/t/widget-exposed-variable-fails-to-capture-value-which-is-set-during-construction/2018028/4 "2024-09-13T08:26:27Z")

</div>

> 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:

> [@Creating a combat log in Blueprint](https://forums.unrealengine.com/t/creating-a-combat-log-in-blueprint/150005/10):
>
> No problem, if you want to experiment with the List View instead: create an Object class blueprint in the content browser with an exposed text variable - it will be used to store data in the list view, called Entry Data below. once you have it, you can do this in the wLogLine’s class settings: The Implemented Interfaces bit on the left is the critical part here! It allows you to pull the data from a list view object and assign it to the widget’s variable. Th…

---

<div class="post-metadata">

**Author:** ![PREDALIEN](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/predalien/32/1194670_2.png) [@PREDALIEN](https://forums.unrealengine.com/u/PREDALIEN)\
**Post date:** [September 13, 2024, 8:39am UTC](https://forums.unrealengine.com/t/widget-exposed-variable-fails-to-capture-value-which-is-set-during-construction/2018028/5 "2024-09-13T08:39:35Z")

</div>

Right, I already forgot how List View works… 😑

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?

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [September 13, 2024, 8:44am UTC](https://forums.unrealengine.com/t/widget-exposed-variable-fails-to-capture-value-which-is-set-during-construction/2018028/6 "2024-09-13T08:44:36Z")

</div>

> [@PREDALIEN](#):
>
> have you checked how List View will behave if you make a dynamic item class, a kind of wrapper

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.

---

<div class="post-metadata">

**Author:** ![PREDALIEN](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/predalien/32/1194670_2.png) [@PREDALIEN](https://forums.unrealengine.com/u/PREDALIEN)\
**Post date:** [September 13, 2024, 8:47am UTC](https://forums.unrealengine.com/t/widget-exposed-variable-fails-to-capture-value-which-is-set-during-construction/2018028/7 "2024-09-13T08:47:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Denomee](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Denomee](https://forums.unrealengine.com/u/Denomee)\
**Post date:** [September 13, 2024, 9:15am UTC](https://forums.unrealengine.com/t/widget-exposed-variable-fails-to-capture-value-which-is-set-during-construction/2018028/8 "2024-09-13T09:15:27Z")

</div>

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:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/6/e/d6e7664dddcd1fe47800d48068b1a40c3111d1f9.png)

I really appreciate the help!

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [October 13, 2024, 9:15am UTC](https://forums.unrealengine.com/t/widget-exposed-variable-fails-to-capture-value-which-is-set-during-construction/2018028/9 "2024-10-13T09:15:27Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
