Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Drag-n-Drop with Treeview
Message
 
À
25/01/2012 14:05:54
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
01533726
Message ID:
01533732
Vues:
83
This message has been marked as the solution to the initial question of the thread.
>I am wanting to be able to drag a selection of files from the Windows Explorer and be able to drop the files onto a Treeview and then have the Treeview process the list of files. To do this I have implemented the following in the TreeView control:
>
>Set the property:
>
>
>OLEDropMode = 1
>
>
>Set the method:
>
>
>PROCEDURE OLEDragDrop
>LPARAMETERS toDataObject, tnEffect, tnButton, tnShift, tnXCoord, tnYCoord
>LOCAL loNode
>LOCAL ARRAY laValues[1]
>loNode = this.HitTest(GKPPixelsToTwips(tnXCoord,"H"),GKPPixelsToTwips(tnYCoord,"V"))
>IF VARTYPE(loNode) = "O"
>	this.NodeDroppedOn = loNode
>ELSE
>	this.NodeDroppedOn = .NULL.
>ENDIF
>DO CASE
>	CASE toDataObject.GetFormat(CF_TEXT)         && CF_TEXT is a #DEFINE with value 15
>		lcText = toDataObject.GetData(CF_TEXT)
>
>	CASE toDataObject.GetFormat(CF_FILES)
>		toDataObject.GetData(CF_FILES, @laValues )
>		FOR lnNdx=1 TO ALEN(laValues)
>*			process files
>		ENDFOR
>ENDCASE
>ENDFUNC
>
>
>The above works for text type data. However the GetData method call:
>
>
>toDataObject.GetData(CF_FILES, @laValues )
>
>
>is giving an error of invalid number of parameters. Can anybody provide some clue here as to what parameters are expected?
>
>Thank you.

toDataObject in TreeView is not the same dataobject as in VFP.
Here what I found and think it should help:
*** ActiveX Control Event ***
LPARAMETERS data, effect, button, shift, x, y
IF data.getFormat(15)
   loFiles = data.Files
   If NOT ISNULL(loFiles)
      For i = 1 To loFiles.Count
          f = loFiles.Item(i)
          this.Nodes.Add(,1,SYS(2015),f)
      Next
    EndIf
ENDIF
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform