ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Controls, pages and windows / Drag and drop functions
  • Variables
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
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.
Example
// Procedure called by the dndBeginDrag event
PROCÉDURE BeginDrag()
// The value of the source control ("EDT_Edit") is copied/moved
// This data is a character string
DnDCacheData(CF_TEXT, EDT_Edit.Value)
// Procedure called in the code for Beginning of Drag/Drop
// to perform a Drag and Drop
// to the file explorer or to another application
PROCEDURE DNDToExplorer(sListFilePaths)
 
// Windows structure used to manage
// Drag/Drop with the explorer
POINT is Structure
x, y are int
END
 
DROPFILES is Structure
// Pointer to the list of files
pFiles is int
// Source position of mouse
PT is POINT
// Reserved
fNC is boolean
// True if the list of files is in UNICODE, False otherwise
fWide is boolean
END
 
// Fills a HDROP structure
stDROPFILES is DROPFILES
stDROPFILES:fWide = True // False for Ansi, otherwise Unicode,
stDROPFILES:fNC = True // Coordinates of PT in client area
stDROPFILES:PT:x = 0
stDROPFILES:PT:y = 0
stDROPFILES:pFiles = Dimension(stDROPFILES) // Size of structure
 
// sListFilePaths contains the list of files separated by CR characters
// for the multi-files, the CR character is replaced with a binary zero,
// and the 2 ending binary zeros are added
bufListOfFiles is Buffer
IF TypeVar(sListFilePaths) = wlUnicodeString THEN
bufListOfFiles = Replace(sListFilePaths, CR, ...
CharactUnicode(0)) + CharactUnicode(0) + CharactUnicode(0)
stDROPFILES:fWide = True // True for Unicode
ELSE
bufListOfFiles = Replace(sListFilePaths, CR, ...
Charact(0)) + Charact(0) + Charact(0)
stDROPFILES:fWide = False // False for Ansi, otherwise Unicode,
END
 
// Transfer the content of the structure into the buffer
// Calculate the necessary total size:
// size of structure and size of file names
// with the 2 ending Unicode binary zeros
nSize is int
nSize = Dimension(stDROPFILES) + Length(bufListOfFiles)
 
// Allocates a buffer for the DROP information
// to the requested size with binary zeros
bufDropData is Buffer
bufDropData = RepeatString(Charact(0), nSize)
// Includes the information of the stDROPFILES structure in the buffer
Transfer(&bufDropData, &stDROPFILES, Dimension(stDROPFILES))
// After the buffer, includes the names of files
Transfer(&bufDropData + Dimension(stDROPFILES), ...
&bufListOfFiles, Length(bufListOfFiles))
 
// Indicates that it is a file DROP
DnDCacheData(CF_HDROP, &bufDropData, nSize)
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:
    Data1 is string = CUSTOMER.KEY + TAB + INVOICE.PRICE
    DnDCacheData("MyType", Data1)

    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:
    Data1 is string = CUSTOMER.KEY + TAB + INVOICE.PRICE
    DnDCacheData("MyType", Data1)

    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 possible values are: dndCopy, dndMove and dndNone.

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: the Ctrl key is pressed.
  • False: the Ctrl 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: wd290obj.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help