How would I go about making a movable widget?

How would I go about making a movable widget with either with BP or C++?

I tried to find a way to make my widget movable but I didn’t see an easy way.
Maybe I’m missing something.

Any ideas?

I’m also interested to know, did you find a solution?

I think we’d like a little more information to help. Do you mean a sliding window? Or do you want it to rotate on a corner axis? Have you tried some basic matinee stuff such as this?

oooh okay. Sorry I don’t know. You might want to repost your question with better wording and delete this one. :slight_smile:

This is my fault for not being very clear.

By window I meant widget.
To be able to create movable HUD/UI elements.

I am not sure if bigzer meant the same kind of “Window”.

Hello,

I have an example of a widget that can be dragged around the screen as along as the mouse button is held down on it. I have included my blueprints via a notepad file. You can simply copy and paste them into their respective blueprints. This will give a good starting point. [MyCharacter_BP][1] and [YourWidget_BP][2] I hope this helps.

My Character blueprint:

My Widget:

20791-draghelp2.png

Make it a great day

Rudy,

Thanks for getting back to me.
I have tried using your method but I can not seem to get it to work.
One thing to note is that I am using a top down(click to move) project.

But I have also tried in an empty project, and although the throbber does jump around it does not stay attached when “dragging”.

Here is the project I created:
https://www.dropbox.com/s/jkfgt4h3nb9gxvr/MyProject.rar?dl=0

Hello,

One quick question before we jump into things. When you are testing on the workaround are you doing it in the editor window or a standalone? When I tested this workaround, I did so in a standalone window. This may make a difference.

A new editor window.
But I would need it to work windowed or full screen.

Hello,

Make sure that you have your anchor is the upper left corner for your widget. I have also made a slight change that will help center the widget on the mouse when dragging. This may help. Also I noticed that the project you provided wasn’t working due to there being no character in the level. Let me know if any of this information helps.

The slight change was:

Thanks again for all your help.
It works as long as the window is smaller than my desktop resolution and the window is not resized.
But if I set it to my desktop resolution the widget is offset to the left.

You can see what I mean by a similar post I made with screenshots:

Is there a way to disable resizing of windows?
Also is there a way to play fullscreen?

Hello ,

I have went back and looked through my blueprints. I have corrected the offset error by setting the anchor instead of the position of the widget. After testing it appears to maintain it’s accuracy through all window sizes and changes. If there are any more errors with my blueprints please let me know. I hope this update helps.

NOTE: The node name covered by the tool tip is the SET POSITION node for the widget. It just needs to be set to 0,0.

Make it a great day

Ok that seems to do it.
Thanks for the help!

I’ve been experimenting with this in UE 4.9. It seems that the ‘Slot as Canvas Slot’ behaviour has changed. Widgets created through blueprints don’t get added on a Canvas Panel. Only Widgets that were defined as being on a Canvas to begin with allow interaction through Slot as Canvas.

Hello Shrooblord,

Thank you for sharing your information. Please keep in mind that this example was made for an older version of the engine and may no longer be an effective method. Please feel free to share your solutions for the more recent versions of the engine.

Make it a great day

This solution worked perfect for me. Thanks for sharing

this post resolve all my problems, just use “get viewport scale”

https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/22260-umg-mouse-screen-position-problem?p=262344#post262344