Hi John,

Using the pasteboard for drag and drop is so much easier.

4D changes clipboards briefly during the drag and drop events. 

Whatever was in the pasteboard **before** “On Begin Drag Over” is restored 
**after** the “On Drop” event completes.

This means you can store drag information in the pasteboard during the “On 
Begin Drag Over” event. Then retrieve that information during the “On Drop” 
event. This “silent” pasteboard switching allows storing drag information 
during the “On Begin Drag Over” event and retrieving that information during 
the “On Drop” event. After “On Drop” completes, whatever was in the pasteboard 
before “On Begin Drag Over” is returned to the pasteboard.

You also need to set 1-specific property for the source object: enable the “On 
Begin Drag Over” event.

2-specific properties are needed for the destination object: enable both 
“Droppable” action and “On Drop” event.

In the source object, have code like this:

-----------
Case of
  :(form event=On Begin Drag Over)

   // Create an object containing info you want to get on drop. Then store in 
pasteboard.
  $o := New object(….)
 SET TEXT TO PASTEBOARD(JSON Stringify($o)

End case
-----------

In the destination object, have code like this:

-----------
Case of
  :(form event=On Begin Drag Over)

   // Retrieve the drop information
  $json_t:=Get text from pasteboard
  SET TEXT TO PASTEBOARD(JSON Stringify($o))
  $o:=JSON Parse($json_t)

End case
-----------

Best regards,
Jeremy

> On Feb 14, 2019, at 11:55 AM, John J Foster via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> am also in process of learning to use the pasteboard to get rid of the 
> obsolete command. Any help would be appreciated.

**********************************************************************
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