Widget doesnt update after Drag and Drop Operation

Hey guys.

I have a weird issue here.

After I drag and drop my custom UUserWidget it doesnt seem to be updated anymore.

My Widget contains an UOverlay which holds an Image and a TextBlock.
It represents an Inventory Item which can be stacked.

When I drag an Item of the same type to another one they will be stacked together and the TextBlock updates itself

EDIT: Flip flopping the Visibility from Hidden to Visible still seems to work. But setting the Text does nothing anymore

A few Images to visualize my problems:

This is the default view of my Grid

135621-img1.png

Now I drag the a medikit to the last one. The Text of the last one updates and shows 2

135622-img2.png

Now I drag it to another slot at the bottom

135623-img3.png

Finally I drag another Item into the one at the bottom, but the Text doesnt update anymore. (The Text should be “3”)

135624-img4.png

I googled this issue and found a Bug Report, but it is stated as resolved.

and

I hope someone can help me with that problem
Thank in advance for your answers :slight_smile:

Hello Cloudy McStrife,

I have reopened the issue dealing with widget not updating after dragging and dropping them. I hope that this helps.

Link: Unreal Engine Issues and Bug Tracker (UE-31777)

Make it a great day

Cool thank you :slight_smile:
Maybe I can help by providing some more information I gathered through debugging.
I just saw that the problem exists because the Widget doesnt rebuild itself anymore
When I close my Inventory and reopen it the Text shows the right number.
This happens after RebuildWidget is called.
Unfortunately it’s a protected function so I cannot test my supposition.

Anyway thank you for reopening the issue :slight_smile:

I have found a work around for this until it gets fixed (works in 4.13.2). But when you drop the widget, get the widget that is being dragged, get its class, and make a new widget from that. Then add that to the canvas/viewport and set its position.

If you have any variables which reference the widget you are moving, you are going to need a function that takes an input of the user widget, casts through all the available references you have until you find the right one, and sets the new widget to be that (and maybe does a refresh of the inventory as well for good measure).