Peter,

This works in two parts.
1) On begin dragover:  You need to capture the mouse xy of the click and
store it in the pasteboard. Something like:

GET MOUSE($x;$y;$mods)

SET TEXT TO PASTEBOARD(Json stringify(New object("x";$x;"y";$y)))


2) On drop: get the data in the pasteboard, calculate delta x and delta y
then apply MOVE OBJECT.
More pseudo code:

$obj:=JSON Parse(GET TEXT FROM PASTEBOARD)
GET MOUSE($x;$y;$mods)

$dX:=$x-$obj.x
$dY:=$y-$obj.y

MOVE OBJECT(*;"object name";$dX;$dY)

The code is off the top of my head so it will need some tweaking but that's
the mechanics. If you are moving a picture on top of another picture (like
a background graphic) you use Drop position to get the drop xy.


On Tue, Nov 20, 2018 at 12:07 PM Peter Mew via 4D_Tech <4d_tech@lists.4d.com>
wrote:

> Hi
> Any ideas on how to implement the following
> Click on an object on a form(a Picture)
> Drag it to a new location
> Have it stay at the new location
> a bonus would be if it could be shown being dragged
> Ive tried various combinations of form events involving the mouse (Mouse
> Enter Mouse Move etc) in the object method, with mouse button down.
> GET MOUSE
> OBJECT GET CORDINATES
> Thanks
> -pm
> 4D v13.6
> Mac OS Yosemite
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **********************************************************************



-- 
Kirk Brooks
San Francisco, CA
=======================

*We go vote - they go home*
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to