Widget - Adding Child On Drop, widget not updating

So this is going to be an elaborate post. As I tried to implement a drag & drop system, I could add widgets to a scroll box in the order they were dropped. Then I implemented the functionality to drop the widget at the index it was dropped at, as such:

120641-1dragdrop.png

Adding space, moving the widgets down as you hover a dragable widget (the green area), is done through simply increasing the padding of a widget component. But now I notice some strange behavior. The widget that is dropped on stops updating its visual layout. So as the most recently (dropped ON, not dropped) widget receives the “on drag enter” event, I can using print string see that the padding is set to the exploded state, 60, but it does not update visually.
This is the function to update the scroll box’s widgets order:

And to visualize the problem, when they are updated they receive the exploded state, (padding top 60), resulting in:

120643-3exploded.png

Here index 1 (starting at 0) widget was dropped on, thus inserting the dropped item at that index, pushing the dropped on widget to the index 2, which is not exploded.

Notice the timer node in the function. If this exact node setup is executed but on the next frame then the dropped on widget works like every other. I would be content with that solution if it wasn’t for the fact that now the below widgets jitter a bit because it’s not updated until the next frame.

It should be easy to reproduce but I can provide the project with the current setup and a much more simple setup that shows the problem.

Reproduction:
A1. Create the dropable scroll box user widget, add a border and a scroll box to its design. Override On Drop with the following:

A2. New function called “Delayed” with Add child node, target: scrollbox, content: tempwidgetref.

B1. create the dragable user widget. Delete canvas, add border, text block. Border is variable.

B2. override On Drag Detected, “create drag drop operation”, self as payload & drag visual.

B3. override On mouse button down - detect drag if pressed.

C: Add the following setup:

D: Add the things to viewport. Maybe create a second scroll box that holds the dragable widgets.

If done correctly, you will be able to drag the widgets and as they hover over other dragable widgets in the initial scroll box, they will change color. But if add them to the dropable scroll box, they will no longer switch color visually as you drag things over them, but the print string shows that their color values change.

Now the delay, instead of On Drop - add child, On Drop - set timer by function name. The widgets will now change their color visually.

Even though the problems are a bit different, they share the fact that adding the widget as a child on the same frame makes it not work, so I feel they are at the core the same issue.

Hello ste1nar,

I was unable to reproduce this issue on our end. I have a few questions for you that will help narrow down what issue it is that you are experiencing.

Quick questions:

  1. Can you reproduce this issue in a clean project?
  2. If so, could you refine your steps to provide more detail to reproduce this issue on our end?
  3. Could you provide screen shots of any other blueprints/widget/settings that may be involved with this issue?

Hello. Indeed I can, I reproduced the issue in a clean first person shooter template. I shall provide the project.

Notes:
First person character is of little relevance. It was modified simply with set input mode game & ui, show mouse cursor and the methods for creating the widgets, adding them to viewport and adding the dragable widget to a scroll box.

InitialScrollboxwidget is of no relevance. It just holds the dragable widgets from the start.

Drag widget moderate relevance. Has methods for changing color as well as printing their values on drag enter and on drag leave. As well as detecting the drag and creating drag drop operation on drag detected . This is the widget that ‘bugs’.

Dropable scroll box widget is the most relevant blueprint. It has an On Drop function where you can select if it should add the child this frame or with a delay.

If you choose directly, then the added widgets placed in the scroll box will not update their visuals as mentioned, but if a delay is used they they will work as expected.

Notice the difference between dragging over the left scroll box and the right scroll box.

I was able to reproduce this issue with the project provided. I have written up a report and I have submitted it to the developers for further consideration. I have also provided a link to the public tracker. Please feel free to use the link provided for future updates. Thank you for your time and information.

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

Make it a great day