ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Controls, pages and windows / Drag and drop functions
  • Variables
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Indicates the type of data and the data to copy/move during Drag/Drop.
Remarks:
  • DnDCacheData must be used during the call to the dndBeginDrag event (DnDEvent).
  • DnDCacheData can be used several times with different formats to copy different types of data from the source.
// Procédure appelée par l'événement dndDébutGlisser
PROCEDURE DébutGlisser()
// La valeur du champ source "SAI_Saisie" est copiée/déplacée
// Le type de cette donnée est une chaîne de caractères
DnDCacheData(CF_TEXT, SAI_Saisie.Valeur)
// Procédure appelée dans le code de Début de Glisser/Déplacer
// pour effectuer du Drag and Drop 
// vers l'explorateur de fichiers ou une autre application
PROCEDURE DNDVersExplorateur(sListeCheminFichier)

// Structure Windows permettant de gérer 
// le Glisser/Déplacer avec l'explorateur
POINT is Structure
	x, y are int
END

DROPFILES is Structure
	// Pointeur vers la liste des fichiers
	pFiles is int
	// Position d'origine de la souris
	PT is POINT
	// Réservé
	fNC is boolean 
	// Vrai si la liste des fichiers est en Unicode, Faux sinon
	fWide is boolean 
END

// Remplit une structure HDROP
stDROPFILES is DROPFILES
stDROPFILES:fWide = True // Faux pour Ansi, sinon Unicode, 
stDROPFILES:fNC = True // Coordonnées de PT dans zone cliente
stDROPFILES:PT:x = 0
stDROPFILES:PT:y = 0
stDROPFILES:pFiles = Dimension(stDROPFILES) // Taille de la structure

// sListeCheminFichier contient la liste des fichiers séparés par RC
// pour les Dnd multifichiers, le RC est remplacé par un zéro binaire, 
// et les 2 zéro binaires de terminaison sont ajoutés
bufListeDeFichiers is Buffer
IF TypeVar(sListeCheminFichier) = wlUnicodeString THEN
	bufListeDeFichiers = Replace(sListeCheminFichier, CR, ...
		CharactUnicode(0)) + CharactUnicode(0) + CharactUnicode(0)
	stDROPFILES:fWide = True // Vrai pour Unicode
ELSE
	bufListeDeFichiers = Replace(sListeCheminFichier, CR, ...
		Charact(0)) + Charact(0) + Charact(0)
	stDROPFILES:fWide = False // Faux pour Ansi, sinon Unicode, 
END

// Transfert du contenu de la structure dans le buffer
// Calcul de la taille totale nécessaire : 
// taille de la structure et de la taille des noms de fichiers 
// avec les 2 zéros binaires unicode de terminaison
nTaille is int
nTaille = Dimension(stDROPFILES) + Length(bufListeDeFichiers)

// Alloue un buffer pour toutes les informations du DROP
// à la taille souhaitée avec des 0 binaire dedans
bufDonneesDrop is Buffer
bufDonneesDrop = RepeatString(Charact(0), nTaille)
// Met les informations de la structure stDROPFILES dans le buffer
Transfer(&bufDonneesDrop, &stDROPFILES, Dimension(stDROPFILES))
// A la suite du buffer, met les noms des fichiers
Transfer(&bufDonneesDrop + Dimension(stDROPFILES), ...
	&bufListeDeFichiers, Length(bufListeDeFichiers))

// Indique que c'est un DROP de fichier
DnDCacheData(CF_HDROP, &bufDonneesDrop, nTaille)
Syntax

Drag and Drop between WINDEV applications Hide the details

DnDCacheData(<Type of data> , <Data> [, <Size>])
<Type of data>: Integer or character string
Type of data copied/moved.
  • Preset data types:
    Only some types of data are presented below. For more details, see the Microsoft documentation ("Standard Clipboard Formats").
    CF_BITMAP2.BMP (bitmap image)
    CF_DIB8.DIB (bitmap independent from the device managers)
    CF_DIF5Data interchange format (lotus)
    CF_ENHMETAFILE14.EMF (Windows 32-bit graphic primitives )
    CF_HDROP15Format of "dropped" file (in Windows NT)
    CF_LOCALE16Format local to Windows (in Windows NT)
    CF_METAFILEPICT3.WMF (graphic primitive file)
    CF_OEMTEXT7OEM string ending with a \0 character
    CF_PALETTE9Palette (Windows standard)
    CF_PENDATA10Optical pen
    CF_RIFF11Audio format
    CF_SYLK4.SLK, Excel, Multiplan
    CF_TEXT1ANSI string ending with a \0 character
    CF_TIFF6.TIF (TIFF image)
    CF_UNICODETEXT13Text string with characters coded on 2 bytes (support for internationalization)
    CF_WAVE12.WAV (sound data)
  • Character string:
    Type of data created beforehand.
    For example:
    Donnée1 is string = CLIENT.CLE + TAB + FACTURE.PRIX
    DnDCacheData("MonType", Donnée1)

    The "MyType" type will correspond to what was assigned to the "Data" string.
<Data>: Character string
Data to retrieve.
<Size>: Optional integer
Number of bytes that will be assigned to <Data>.

Drag and Drop between a WINDEV application and a Windows application Hide the details

DnDCacheData(<Type of data> , <Pointer> [, <Size>])
<Type of data>: Integer or character string
Type of data copied/moved.
  • Preset data types:
    Only some types of data are presented below. For more details, see the Microsoft documentation ("Standard Clipboard Formats").
    CF_BITMAP2.BMP (bitmap image)
    CF_DIB8.DIB (bitmap independent from the device managers)
    CF_DIF5Data interchange format (lotus)
    CF_ENHMETAFILE14.EMF (Windows 32-bit graphic primitives )
    CF_HDROP15Format of "dropped" file (in Windows NT)
    CF_LOCALE16Format local to Windows (in Windows NT)
    CF_METAFILEPICT3.WMF (graphic primitive file)
    CF_OEMTEXT7OEM string ending with a \0 character
    CF_PALETTE9Palette (Windows standard)
    CF_PENDATA10Optical pen
    CF_RIFF11Audio format
    CF_SYLK4.SLK, Excel, Multiplan
    CF_TEXT1ANSI string ending with a \0 character
    CF_TIFF6.TIF (TIFF image)
    CF_UNICODETEXT13Text string with characters coded on 2 bytes (support for internationalization)
    CF_WAVE12.WAV (sound data)
  • Character string:
    Type of data created beforehand.
    For example:
    Donnée1 is string = CLIENT.CLE + TAB + FACTURE.PRIX
    DnDCacheData("MonType", Donnée1)

    The "MyType" type will correspond to what was assigned to the "Data" string.
<Pointer>: Integer
Pointer to a character string, a structure, ...
<Size>: Optional integer
Number of bytes that will be assigned to <Pointer>.
Remarks

Variables

The following variables can be used:
Variable nameDescription
_DND.ActionAction specified in DnDAccept.

The various possible values are as follows: dndCopy, dndMove and dndProhibited.

This variable is not filled at the beginning of Drag and Drop in a source control (dndBeginDrag constant) or when exiting from a target control (dndDragLeave constant).
_DND.TargetControlName of target control.

This variable is not filled at the beginning of Drag and Drop in a source control (dndBeginDrag constant) or when exiting from a target control (dndDragLeave constant).
_DND.SourceControlName of source control.
_DND.CtrlDownStatus of Ctrl key:
  • True: Ctrl control key pressed.
  • False the Ctrl control key is not pressed.
This variable is not filled at the beginning of Drag and Drop in a source control (dndBeginDrag constant) or when exiting from a target control (dndDragLeave constant).
_DND.SourceWinName of source window.

This variable is not filled when exiting from a target control (dndDragLeave constant).
_DND.MouseXPosHorizontal position (X) of mouse cursor in relation to the control handled during the event.

This variable is not filled when exiting from a target control (dndDragLeave constant).
_DND.MouseYPosVertical position (Y) of mouse cursor in relation to the control handled during the event.

This variable is not filled when exiting from a target control (dndDragLeave constant).

The _DND.SourceControl and _DND.SourceWin variables return an empty string ("") when the Drag and Drop comes from an application other than the current application.
Component: wd300obj.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help