# The field changed in the widget blueprint replaces the actual value from the bound C++ widget class

**URL:** <https://forums.unrealengine.com/t/the-field-changed-in-the-widget-blueprint-replaces-the-actual-value-from-the-bound-c-widget-class/2183309>\
**Category:** C++\
**Tags:** unreal-engine, editor, Widget, CPP, question\
**Created:** [December 8, 2024, 11:18am UTC](https://forums.unrealengine.com/t/the-field-changed-in-the-widget-blueprint-replaces-the-actual-value-from-the-bound-c-widget-class/2183309 "2024-12-08T11:18:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alchezar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Alchezar](https://forums.unrealengine.com/u/Alchezar)\
**Post date:** [December 8, 2024, 11:18am UTC](https://forums.unrealengine.com/t/the-field-changed-in-the-widget-blueprint-replaces-the-actual-value-from-the-bound-c-widget-class/2183309/1 "2024-12-08T11:18:39Z")

</div>

There are two widgets - `ParentWidget` and `ChildWidget`. `ChildWidget` is created inside `ParentWidget`. Both of that widgets are bound to the `UUserWidget` child class. `ChildWidget` has bool flag `bBoo` with `UPROPERTY(EditAnywhere)` specifier, so it can be changed either from the editor UI or from the C++ logic, so far so good.  
I make `bBoo=true` through the editor UI, and, after some time, I reset it back to false through the C++ logic. To make it clear, `bBoo` is always gets the value true from the editor UI and false from the C++ code, and all changes are made in the editor, without starting the game.  
Here the strange behavior:  
When later I select this widget in editor UI, `bBoo=false` (as it should be), but after changing the position of the `ChildWidget` - flag `bBoo` changes back to true . It seams that the widget blueprint caches fields, and prefers changes from the UI over changes from bound C++ class.

To sum up, all steps looks like this:

- Change `bBoo=true` in the editor
- At some point `bBoo=false` in C++ logic
- Move `ChildWidget` (`bBoo` displays as false as it should be)
- After releasing the mouse `bBoo` changes back true by itself (last assigned value from editor)

Here are some conclusion from my attempts:

- Adding Transient specifier only makes it worse, so the `bBoo` field always resets to false after moving the `ChildWidget`
- Adding `ExposeOnSpawn=true` meta doesn’t affect anything
- `InvalidateLayoutAndVolatility()` doesn’t affect anything
- `NativeConstruct()` doesn’t fire, because all actions are made in the editor, without starting the game.
- `PostEditChangeProperty()` method doesn’t help, because the value set from C++ already has a lower priority than the value from the editor.

Is it possible in C++ code to clear widget’s cache after changing the `bBoo` flag, or force it to refresh its cache?

This problem is also relevant for other fields. For example, the position of the `ChildWidget`  
So, `ObtainedPosition` returns the last “dragged” position in editor, but not the `ExpectedPosition` from the example

```auto
Cast<UCanvasPanelSlot>(ChildWidget->Slot)->SetPosition(ExpectedPosition);
// ...
const FVector2D ObtainedPosition = Cast<UCanvasPanelSlot>(ChildWidget->Slot)->GetPosition();

```
