cObject
---cWebObject
------cWebDragDropHelper
---------cWebDragDropFileHelper
Adds file drag and drop fuctionality to web controls.
The following classes support elements being dragged for specific actions using the following constants:
cWebList: C_WebDragListRow
cWebTreeView: C_WebDragTreeviewFolder, C_WebDragTreeviewItem
cWebTagsForm: C_WebDragTagsFormTag
Attempting to add an unsupported drag action to a control will result in an Error.
Every web control, including containers like cWebPanel or cWebGroup, supports the C_WebDropOnControl action. This allows the entire control to function as a drop zone.
The following classes support elements being dropped onto for specific actions using the following constants:
All web controls: C_WebDropOnControl
cWebList: C_WebDropListRow
cWebTreeView: C_WebDropTreeviewRoot, C_WebDropTreeviewFolder, C_WebDropTreeviewItem
cWebTagsForm: C_WebDropTagsFormInput
To enable dropping of files onto a control, add a cWebDragDropFileHelper object to your view. The cWebDragDropFileHelper class has all the functionality of the cWebDragDropHelper, but also supports dropping files onto controls registered as a Drop Target.
Any Drop Target added in a cWebDragDropFileHelper object will automatically accept files as a valid Drag Source. When dropping a file, the potential target controls and areas are dictated by how you set up your DropTargets.
For example, the code below adds the oSortedCustomers TreeView as a target, but only allows files to be dropped on Folder nodes.
Object oFileDropHelper is a cWebDragDropFileHelper Send RegisterDropTarget oTreeViewFiles C_WebDropTreeviewFolder
You can add your own business logic to be executed when a file drop happens (before the upload) by implementing the OnFileDrop event.
In the example below, the OnFileDrop uses the drop data provided to extract the folder to upload the dropped filed to, and returns this.
Function OnFileDrop String sFileName Integer iBytes String sMime Handle hoDropTarget WebDropPosition eDropPosition Returns String String sPath tWebTreeViewDropData oDropData Get DropData of hoDropTarget to oDropData Get UploadFolder of ghoWebApp True to sPath Move (sPath + "/DragDropDemo/" + oDropData.data.sName + "/" + sFileName) to sPath Function_Return sPath End_Function Procedure OnFileFinished String sFileName String sLocalPath Forward Send OnFileFinished sFileName sLocalPath Send FullRefresh of oTreeViewFiles End_Procedure