Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to Drag&Drop from ActiveX to a Container Class
Message
De
14/02/2005 17:55:34
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows NT
Database:
Visual FoxPro
Divers
Thread ID:
00986705
Message ID:
00986838
Vues:
33
>Take a look in Solution Samples "Treeview/Listbox drag and drop"

ah ja - comp,letely foregot about those samples <s>, thanks for reminding me.

now i copied the code into my app, and right at the begining i get an error.
* *** original code
* *** LPARAMETERS oDataObject, nEffect
* *** LOCAL aValues, i, nSelected

*-- Create an array containing the values of the items that
*   are currently selected in this listbox
* *** nSelected = 0
* *** FOR i = 1 to This.ListCount

* *** 	*-- If the item is selected, add it to an array
* *** 	IF This.Selected( i )
* *** 		nSelected = nSelected + 1

* *** 		DIMENSION aValues[ nSelected ]
* *** 		aValues[ nSelected ] = This.List( i )
* *** 	ENDIF
* *** NEXT

*-- The automatic formats that a ListBox has are CF_TEXT, 
*   CFSTR_OLEVARIANT, and CFSTR_VFPSOURCEOBJECT.  Since we want 
*   to drag multiple items, we also will need to store the data 
*   in a CFSTR_OLEVARIANTARRAY format.
* *** IF nSelected > 0
* *** 	oDataObject.SetData(@aValues)
* *** ENDIF

* *** *******************************************************
* *** my code
*** ActiveX Control Event ***
LPARAMETERS DATA, allowedeffects
* ***	LPARAMETERS oDataObject, nEffect
LOCAL aValues, i, nSelected

*-- Create an array containing the values of the items that
*   are currently selected in this listbox
DIMENSION aValues[9]
aValues[1] = subs(THIS.SELECTEDITEM.TEXT, 1, 3)
aValues[2] = subs(THIS.SELECTEDITEM.TEXT, 1, 3)
aValues[3] = subs(THIS.SELECTEDITEM.TEXT, 1, 3)
aValues[4] = subs(THIS.SELECTEDITEM.TEXT, 1, 3)
aValues[5] = subs(THIS.SELECTEDITEM.TEXT, 1, 3)
aValues[6] = subs(THIS.SELECTEDITEM.TEXT, 1, 3)
aValues[7] = subs(THIS.SELECTEDITEM.TEXT, 1, 3)
aValues[8] = subs(THIS.SELECTEDITEM.TEXT, 1, 3)
aValues[9] = subs(THIS.SELECTEDITEM.TEXT, 1, 3)


*-- The automatic formats that a ListBox has are CF_TEXT,
*   CFSTR_OLEVARIANT, and CFSTR_VFPSOURCEOBJECT.  Since we want
*   to drag multiple items, we also will need to store the data
*   in a CFSTR_OLEVARIANTARRAY format.
*IF nSelected > 0
	*Data.SetFormat("OLE Variant Array")
	DATA.SETDATA(@aValues, "OLE Variant Array") && error
*ENDIF
the error occurs at the "DATA.SETDATA(@aValues, "OLE Variant Array")". i get a "Type MissMatch" error from the activeX. the array has aValues character data in all elements.

any ideas?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform