Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
OLEDragMode=1
OleDropMode=1
------------------------------
In MouseDown Event:
*** ActiveX Control Event ***
LPARAMETERS button, shift, x, y
loNode = THIS.HitTest( x*15,y*15 )
if VARTYPE(loNode)='O'
THISFORM.NodeTapped = loNode.Key
else
THISFORM.NodeTapped = ''
endif
loNode = .NULL.
------------------------------
In OLEStartDrag Event:
*** ActiveX Control Event ***
LPARAMETERS oData, allowedeffects
LOCAL loDragNode
IF VARTYPE(goOLESpy)<>'O'
* frmDropTarget is my own form that will accept any ole-drag-drop
* and will just show the contents of what was dropped.
* This is just for debugging
RELEASE goOLESPY
PUBLIC goOLESPY
goOLESPY = NEWOBJECT('frmDropTarget','samplelex.vcx')
goOLESPY.LEFT = _SCREEN.Width-goOLESPY.Width
goOLESPY.TOP = 0
goOLESPY.Visible = .T.
endif
if vartype(THISFORM.NodeTapped)='C' && VarType(lcNodeKey)='O'
goOLESPY.Edit1.Value = 'Dragging: '+THISFORM.NodeTapped
* Data is pre-created with an OLEData object
* We can determine what node is being dragged by THIS.SelectedItem/.Key
oData.SetData( 'LEXTREENODE)'+THISFORM.NodeTapped, 1 )
* Bit combination of:
* 0 DROPEFFECT_NONE Drag source did not support any drag operations.
* 1 DROPEFFECT_COPY Drag source supports Copy operations.
* 2 DROPEFFECT_MOVE Drag source supports Move operations (the default).
* 4 DROPEFFECT_LINK Drag source supports link operations.
AllowedEffects = 3 && Move or Copy
else
AllowedEffects = 0
endif
------------------------
In OLEDragOver Event:
*** ActiveX Control Event ***
LPARAMETERS oData, effect, button, shift, x, y, state
IF oData.GetFormat(1) && Has text describing it
lcNodeKey = THIS.HitTest( x*15,y*15 )
THIS.DropHighlight = THIS.HitTest(X*15,Y*15)
if VarType(lcNodeKey)='O'
lcNodeKey = lcNodeKey.Key
if vartype(goOLESPY)='O'
goOLESPY.Edit1.Value = 'DRAG OVER> '+lcNodeKey
endif
Effect = 2 && Move
RETURN
* Here we need to determine whether the dragged node can be dropped here.
* lcNodeKey is the node that it's being dropped on.
* if NOT InList(upper(lcNodeKey),'SEA','LEA')
* Effect = 2 && Move
* RETURN
* endif
endif
Effect = 0 && None
ENDIF
--------------------------------
In OleDragDrop Event:
*** ActiveX Control Event ***
LPARAMETERS oData, effect, button, shift, x, y
LOCAL lcNodeDropped, lcCatchingNode, loNodeDropped, loCatchingNode, ;
lcNodeType, lcParentType, laType[1,5], lnTypes, laWrk[4], lnWrk, lnI
IF oData.GetFormat(1)
THIS.DropHighlight = .NULL.
* Here, we have to figure out what to do when this node is dropped on.
lcNodeDropped = oData.GetData(1)
DO CASE
CASE lcNodeDropped='LEXTREENODE)'
* 1234567890123
lcNodeDropped = SUBSTR(lcNodeDropped,13)
loCatchingNode = THIS.HitTest( x*15,y*15 )
if VarType(loCatchingNode)='O'
lcCatchingNode = loCatchingNode.Key