In the following example, the onLeftMouseDown event of a TreeView object is used to initiate a Drag&Drop Copy operation. The filename containing the TreeView’s child TreeItems, along with a string identifying the TreeView as the Drop Source, is passed to the Drop Target. If the drop attempt fails or the Drop Target’s onDrop returns false, the drag( ) method cleans up by deleting the file.

function TREEVIEW1_onLeftMouseDown(flags, col, row)

   local cFileName

    cFileName = funique("TREE????.TXT")   // File to hold child TreeItems

    this.streamChildren(cFileName)

    if not this.drag(this.className, cFileName, "")

        delete file (cFileName)

    endIf

 return