Confused : How avoid dropping when destination is source

Hi,

Windows, 4D v18 R2

I have an array-based listbox
This listbox is draggable AND droppable (for dragging and dropping documents)
I use On Begin Drag Over and SET FILE TO PASTEBOARD to implement dropping documents on the desktop
However, now the On Drag Over event is not fired anymore
I don’t know how to avoid dropping a listbox line on the same listbox, so when the destination is the source
Does anybody know what I am doing wrong?

If I understand correctly, I’d do it like this.

On Begin drag
Put the files into the container to allow drop on desktop & add a private data to flag that the drag was initiate from the listbox.

C_blob($data)
APPEND DATA TO PASTEBOARD ( "com.listbox.private" ; $data )

On Drag over
Test if the data comes from an external source

GET PASTEBOARD DATA TYPE ( $signatures ; $nativeTypes) 
If(find in array($signatures;"com.listbox.private")>0)
$0:=-1// internal -> refuse drop
Else
$0:=0//external -> accept drop (if there is files…)
End if

Hi,

It looks my direction for the solution is the same as yours
But… somehow the “On Drag over” event is not fired in my listbox, even though the event has been checked
There must be a reason for this, I will try to find out

How are set the d&d properties?

@vdl

Windows, 4D v18R2
Hi, To make sure I created a test DB with 1 form
On this form an 1 array based listbox with 3 rows
Draggable and Droppable properties checked
On begin Drag Over, On Drag over and On Drop events checked
Alerts in the form events
I am sure On Drag Over is not fired
Is this a bug, or something I am missing?

I’ll give it a try on my own, and I’ll let you know

@Piotr_Chabot_Stadhou

Tested on macOS