I’ve wrote this decades ago, in my case I’m working with a tree.
-
On your LIST set the DRAGID and the DROP to include the same ID
ex:LIST,DRAGID('ThisQ', 'AnotherPlace'),DROPID('ThisQ') -
when
EVENT() = EVENT:Drag
! GET( FromQ, ?List{PROPList:MouseDownRow) ! see comments below by Jeff Slarve
GET( FromQ, ?List{PROPList:MouseDownRow + 0)
SETDROPID( 'PK=' & Q.PK )
- when
EVENT() = EVENT:Drop
DropRow = ?List{PROPList:MouseUpRow)
IF DropRow > RECORDS( FromQ )
DropRow = RECORDS( FromQ )
END
?List{PROP:Selected} = DropRow
DropString = DropID()
! parse DropString to get the PK
! make your change in the queue and underlying data
- Consider having a checkbox to control if you are allowing dragging
as it can be easy to for a user to accidentally perform a drag
WhenACCEPTED() = ?UI:CanDrag
IF UI:CanDrag
?List{PROP:DragID, 1} = 'ThisQ'
?List{PROP:DragID, 2} = 'AnotherPlace'
ELSE
?List{PROP:DragID, 1} = ''
END