Widget drag and drop bug?

Hello,

i have inventory widget with implemented drag and drop function. My issue is when dragging is started my widget disappear for half of second like in this video.

Do anyone know why this happen?

Thanks for any answer.

Don’t Remove from Parent, not yet - hide it instead for now. Use the Payload pin so drag OP actually carries information. Although it seems you’ve got it covered with the custom OP with a type correct widget.

A widget can be only in a single container at a time, so there may be no need to remove from parent. Once you drop the payload in the new container, it will be automatically removed from the old one. And if the drag fails (for any reason), the widget is still in the original, correct container and you may simply just show it.

First of all i dont know for what payload pin is and how its work so i go learn it and then i try apply it. Thanks for the answer!

First problem i have with this is when i Set visible to hidden instead Remove from Parent Default drag visual is hidden too so i dont see what draging where.

Any idea?

what payload pin is and how its work

Payload is the widget that is being dragged:

So you can get access to it when it drops:

353318-screenshot-2.png

You’re using a custom drag and drop OP (followed a tutorial perhaps?) so it might be fine as is. Your Widget to Drag performs the same function probably, just saying the default Payload behaviour is usually more than fine.


First problem i have with this is when
i Set visible to hidden instead Remove
from Parent Default drag visual is
hidden too so i dont see what draging
where.

Makes sense. That’s because the visual should, ideally, be a separate widget:

Something along the lines of:

This temporary drag visual will be destroyed as soon as the drag OP terminates. This will give you a chance to detach the actual dragged content from how it looks like during drag. Perhaps you’ll want a fancy animation during drag or some special behaviour the actual dragged widget does need to care about. And will also allow you to hide the dragged widget until it’s successfully reparented into its new container.


The way you’re doing it at the moment it’s somewhat risky. You end up with an orphaned dragged widget that is referenced only by the drag OP - the dragged widget has no container that would otherwise keep it alive. If the drag OP gets cancelled and you mishandle it, the widget will be lost forever. There goes a stack of 10k gold… :wink:

If you were to go this route:

  • the temporary drag visual can be simple and if you include a SizeBox, you get to choose the size:

  • you can pipe in new data via exposed variables:

  • so when the visual is created, you get to choose what is shows:

Thank You so much for answer!!

The widget i want to drag is only visual representation of Inventory so if widget be lost u can recreate it by reopen it so no gold be lost i guess :-).

I try do it like on my pictures. Its work but probably i dont use the Payload think.
Its good like this or not?

Thanks for answer.


It’s fine for as long as it works!

You do not need to use the Payload, you have your own Widget To Drag (same as payload); you can disconnect Payload and it won’t change a thing.

Thanks you so much!! U are best!