Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to Drag&Drop from ActiveX to a Container Class
Message
From
14/02/2005 17:55:34
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows NT
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00986705
Message ID:
00986838
Views:
34
>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?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform