Draw texture on top of umg

So I have a basic UMG setup and an inventory that pops up when I push the I button. Right now I have a click and drag for moving items between slots and I am using Draw Simple Texture to draw the icon at the cursor to move it around the screen. Everything works like it should except that the texture is being drawn underneath the UMG inventory. How would I go about having the texture be drawn on top? the Zorder for everything in UMG is 0.

bump

Not sure about the etiquette on bumping on this website. Anyone have an answer to this? I have been unable to resolve it.

the easiest answer would be to change the logic from the hUD drawSimpleTexture to your main widget or even anothe widget with a higher zorder.

DrawTextureSimple is for other uses/old stuff. you can take an image and bind to onmouseeter and onmousestop or whatever they are called, been a few weeks since i made adrag and drop umg widget.

So I am trying to make a separate UMG widget for the actual dragging item, which is just an image. Everything is working up until the point where I am trying to refresh the position of the widget in my HUD widget. The function Set Position in Viewport is not working. Is this function only allowed to be called during construction? I tried calling a transform function and it moved the widget, but it only moves it by X amount of pixels, you can’t set the position to the mouse coordinates like you could in the Set Position function.

In the past I got this all to work without using UMG because UMG did not exist at that point. I manually drew the inventory with draw texture functions and math. However UE seems to phase that method out and wants us to use UMG so I am trying to convert it.

My comment was 200 characters too long so i have to post it as a second answer…

you shouldnt need seperate widget for the dragging item at all. what specific gameplay are you going for. i have my inventory, crafting, place buildings, character levels all within one widget. it can be as simple as getting the specific slot from the panel you have child widgets in and thenn a getposition(slotascanvasslot) node which returns a vector2d (x,y) that can be broken into x,y coordinates or plugged into a set position node or moved some on a tick with an event dispatcher/bool/custom event

staff member rudy tells us how to get and set positions with bps here too

I have an example widget that can get you started. The widget that is in the attached file can be placed in your project’s blueprint folder (It is from a 4.6 project). You can then open up the project and go from there. You will need to add it to viewport. >> [Drag and Drop Widget (This link is the complete widget)][1] <<

My Event Graph:

In my example I am running things from a tick event. As you can see there are three images in the graph. These are what is being moved and parented to another canvas panel. The canvas panel is the one by its self in a comment box.

DragNDropFun:

This is my custom function when it is expanded. I have detailed what all of the different sections do. Currently the output pins are not working correctly due to a known issue, however this can be worked around.

Checking Macro:

This is the “Checking Macro” after it has been expanded. This basically checks to make sure that the widget that is being hovered over is the only one that moves. After then it is sure that you have the right widget it then ignores the “Is hovered node” for smoother dragging.

This is the mouse down function that can be found on the left under the mouse section of the “My Blueprints” panel in your widget. It is setting a boolean value that tell the function that the mouse is down.

Note: The On mouse down function looks the exact same except that the boolean is unchecked (setting it to false)

I hope this helps.

Make it a great day

basically the key is using the ishovered function.the mouse events were what i was trying to remember the name of, they can be found on a border if you place your widget there, or manually though script.

Of course you can dig into slate if you want to go the c++ route, then whatever you may be trying to attempt will be just like home (udk or wherever :slight_smile: )

Am I to understand correctly you create a new panel at a specific location and then move the image to that panel each frame?

So I was able to resolve this myself using this link as a guide.

Basically what I did was create a separate UMG widget for the image I want to drag around. I dragged it onto my main hud widget and set it to hidden and a zorder of 1. You have to cast the dragging widget “As Canvas Slot” and then drag from that output you can call “Set Position”. You can adjust this value to drag the widget across the screen. You can use that guide to help if your window is not the same size as your canvas while testing in the editor.