Example 1 In this example from the w_orderentry window in the ABNC sample application, this code in the DoubleClicked event for the DataWindow dw_orddetail starts a drag operation:
IF dw_orddetail.GetRow() > 0 THEN
dw_orddetail.Drag(Begin!)
This.DragIcon = "dragitem.ico"
END IF
Then in the DragDrop event for a trashcan Picture control, this code deletes the row the user clicked and dragged from the DataWindow control:
long ll_currow
dwitemstatus ldwis_delrow
ll_currow = dw_orddetail.GetRow( )
// Save the row's status flag for later use
ldwis_delrow = dw_orddetail.GetItemStatus &
(ll_currow, 0, Primary!)
// Now, delete the current row from dw_orddetail
dw_orddetail.DeleteRow(0)
Example 2 This example for a trashcan Picture control's DragDrop event checks whether the source of the drag operation is a DataWindow. If so, it asks the user whether to delete the current row in the source DataWindow:
DataWindow ldw_Source
Long ll_RowToDelete
Integer li_Choice
IF source.TypeOf() = DataWindow! THEN
ldw_Source = source
ll_RowToDelete = ldw_Source.GetRow()
IF ll_RowToDelete > 0 THEN
li_Choice = MessageBox("Delete", &
"Delete this row?", Question!, YesNo!, 2)
IF li_Choice = 1 THEN
ldw_Source.DeleteRow(ll_RowToDelete)
END IF
ELSE
Beep(1)
END IF
ELSE
Beep(1)
END IF