KeithTrangmar
Programmer
I've successfully implemented OLEDragDrop in a VFP6 project so that my users can drag-and-drop a file anywhere on the application and a method fires to determine what to do with it. I cribbed the code from
Having now upgraded the project to VFP8, I've had to rework it slightly to use BindEvents(), which is also demonstrated in the same article. But now it's not working - it seems that the OLEDragOver event code isn't being called, as the "wait window" commands that I've added for debugging don't appear. My code looks like this:
Am I doing something obvious?
Keith Trangmar
Harlend Computer Services
Maidstone, Kent. UK.
Having now upgraded the project to VFP8, I've had to rework it slightly to use BindEvents(), which is also demonstrated in the same article. But now it's not working - it seems that the OLEDragOver event code isn't being called, as the "wait window" commands that I've added for debugging don't appear. My code looks like this:
Code:
public oSH
oSH = NEWOBJECT("ScreenHook")
BINDEVENT(_SCREEN,"OLEDragOver",oApp.oSH,"myOLEDragOver")
BINDEVENT(_SCREEN,"OLEDragDrop",oApp.oSH,"myOLEDragDrop")
DEFINE CLASS ScreenHook AS CUSTOM
oScr = _SCREEN
oScr.OLEDropMode=1
oScr.OLEDropEffects=3 && Move and Copy
FUNCTION myOLEDragOver
LPARAMETERS oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord, nState
do case
case oDataObject.GetFormat(15)
this.OLEDropHasData=1
nEffect=1
case oDataObject.GetFormat(1)
wait "OLE data is text" wind nowait
case oDataObject.GetFormat(7)
wait "OLE data is OEM text" wind nowait
case oDataObject.GetFormat(13)
wait "OLE data is Unicode text" wind nowait
otherwise
wait "OLE data is unknown format" wind nowait
endcase
ENDFUNC
FUNCTION myOLEDragDrop
LPARAMETERS oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord
local aFiles(1)
if oDataObject.GetData(15,@aFiles) and alen(aFiles,1)>0
&& Do something with the array of filenames that has been passed as a parameter...
endif
ENDFUNC
ENDDEFINE
Keith Trangmar
Harlend Computer Services
Maidstone, Kent. UK.