How to Drag and Move a Widget?
I have several Widgets I want to move with Drag and Drop. I posted Drag and Move in the Headline because the Usual Drag and Drop is not what I want. Usually You Drag something, It remains in place and a Copy is moved with the Cursor to the destination place... However I don't want to move a Copy, I want to move the original Widget directly.
Thank you very much in advance!
asked Dec 07 '14 at 12:12 AM in Blueprint Scripting
I Solved it on my own. I didn't use any DragVisual. I used the OnDragOver Event to set the new Position. To do so I needed some Information I only get in the OnDragDetected Function. I Save the Result of GetScreenSpaceLocation with Absolute to Local into a Custom Variable of my Widget as an Offset. Pic1
On Drag over Event in the Widget which is a layer under the Draggable Widget (In my case an 'empty' UserInterfaceWidget with just a Canvas). This Event and in the OnDrop Event are the same. In my Case I don't need the payload at all... well maybe later if i can drag more than one mini Windows (Widgets). Thats because my UserInterfaceWidgets has a Variable/Reference to the unique Draggable which I can use. I add it as Child to the Canvas, Cast the return Value to CanvasPanelSlot and can now set the position to whatever I want. I my case it is the position of the MouseCursor. Thats the PointerEvents Screen Space Position calculated in Absolute to local (By the MyGeometry thingy) From that substract the Offset we created earlier. Voila, thats your Drag and Drop/Move to any location Window.
answered Dec 07 '14 at 02:29 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here