Download

[UMG] Drag and Drop Questions

I’m working on a drag and drop inventory and I’ve mostly got it working using the built-in drag and drop interface. I just have a few questions regarding it.

  1. I’d like the drag and drop operation to end when the player closes the inventory. There seems to be a “End Drag Drop” command but it uses the event reply structure which I do not understand and there is pretty much no documentation for it. For now I’m just setting a boolean on the payload that doesn’t allow it to be placed when “On Drop” is called when the player closes the inventory then scaling the visual down to 0 so it can’t be seen, but it’s obvious that the drag/drop operation is still happening. How can I force it to stop?

  2. I’m using a custom mouse, but when I drag/drop the software mouse ends up behind the drag/drop visual and the hardware mouse is on top. So how can I A) make sure the hardware mouse does not appear and B) keep the software mouse above the drag/drop visual?

Thanks to anyone who can answer!

  1. Make a C++ Library call for it, I’ll add one to UWidgetBlueprintLibrary. In C++ you need to call FSlateApplication::Get().CancelDragDrop();

  2. Dunno about this one, if you’re using our software cursor system, the software mouse is drawn after the drag drop content.

This stuff is exactly why i dont use the build in Drag & Drop Mechanism. Its actually pretty easy to implement an own one. If you need a hand just gimme a shout.

  1. Works! I’d still like to see some light shone on the event reply system when possible, but for now it works and I’m happy. Thank you!

As for number 2, I’m not having any luck with that. This is my software cursor:
26f32074c47e18f7368a1d68d42e1c5ac1ee1384.png

And this is my software mouse drawn behind my dnd visual:
85e36cc959f0b12bf608a26363b7adf62d20e6a3.png

The printscreen screenshot doesn’t show it but the default hardware pointer is on top of that. Any advice? I’m running 4.7.5 on Windows 8.1.

Thanks ruohki, you’re always a mensch. I’m like a step away from getting everything to work using the built-in solution, but if it can’t be done I’ll definitely holla. :slight_smile:

  1. The event reply system works like this; you can only use it in cases where you’re overriding functions that expect an EventReply. You either return Handled() or Unhandled() from those functions. If you return Handled(), you can chain any number of those additional event reply functions onto it like capture mouse, or change focus. So like on mouse down, return Handled().CaptureMouse(), is sort of the idea.

As for the software cursor, at least part of your problem is 4.7. We didn’t support fullscreen drag drop in 4.7 if i recall, which means it’s creating a new window to show the drag visual. Meaning, it will always overlap the software cursor. Though this shouldn’t be happening in 4.8; mind trying your project in the latest 4.8 preview?

I’m like 95% sure the hardware cursor wont appear when doing a drag drop in 4.8 if you’re using a software cursor, but ill have to make a mental note to make sure I give that a try tomorrow.

Jared just curious what version you are using? I use the in house drag and drop and have a totally working inventory system without any issues.

Iam curently working on a ui framework that uses the basic umg stuff. It uses the alternative drag & drop way which does not have the cursor problem :slight_smile: Also it has no problems with fullscreen^^

4.8 DOES indeed draw the cursor above the dnd visual. Hardware cursor is still drawn on top.

One new problem is that the inventory toggle is mapped to the TAB key and that seems to be used by the keyboard/controller logic in UMG, or that’s what I assume. If the inventory is open and I hit TAB to close it after or while dragging it creates a perforated outline around the last inventory space I clicked and subsequent TAB presses move the outline to the next space in my grid of spaces. Is there any way to disable this?

4.7.5.

If migration to 4.8 takes more time than it should, I’m coming for you homeboy.