Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
File (filename) dropping unto the _SCREEN object
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Titre:
File (filename) dropping unto the _SCREEN object
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01454355
Message ID:
01454355
Vues:
192
Hi,

I am trying to enable the _SCREEN object so that it receives file names as an OLE Drop from a Windows Explorer Drag. I have no problems being able to do this unto a regular FORM, however, it is the main VFP SCREEN that I want to do this with. Running the code below doesn't result in errors but it also doesn't trigger anything.
_SCREEN.OLEDROPMODE = 1
*!*_SCREEN.OLEDROPEFFECTS = 4

oScrOleDrop = CREATEOBJECT("ScrOleDrop")
BINDEVENT(_SCREEN,"OLEDragDrop",oScrOleDrop,"OLEDRAGDROP")
BINDEVENT(_SCREEN,"OLEDragOver",oScrOleDrop,"OLEDRAGOVER")

DEFINE CLASS ScrOleDrop AS Custom
	PROCEDURE OLEDRAGDROP
	LPARAMETERS oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord
	IF oDataObject.GETFORMAT(15) && File list from Windows Explorer
		LOCAL laFiles(1)
		oDataObject.GETDATA(15,@laFiles)
		FOR EACH lcFile IN laFiles
			WAIT WINDOW lcFile	&& For testing... will be substituted
		NEXT
	ENDIF
	ENDPROC

	PROCEDURE OLEDRAGOVER
	LPARAMETERS oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord, nState
	DO CASE
		CASE nState == 0	&& DRAG_ENTER
			IF oDataObject.Getformat(15)   && File list from Windows Explorer
				_SCREEN.OLEDropHasData = 1 && DROPHASDATA_USEFUL
				_SCREEN.OLEDropEffects = 4 && 1=Copy, 2=Move, 4=Link

				THIS.OLEDropHasData = 1 && DROPHASDATA_USEFUL
				THIS.OLEDropEffects = 4 && 1=Copy, 2=Move, 4=Link

				nEffect = 4
			ENDIF
		CASE nState == 1	&& DRAG_LEAVE
	*!*	CASE nState == DRAG_OVER
	*!*		WAIT WINDOW "Drag over"
	ENDCASE
	ENDPROC
ENDDEFINE
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform