ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Controls, pages and windows / Drag and drop functions
  • Overview
  • Principle
  • Functions specific to the Drag and Drop from the explorer
  • Programming
  • Enabling the management of Drag and Drop from the explorer to the window
  • Processing the "dropped" files
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
Drag and Drop from the explorer
Overview
The Drag and Drop from the explorer consists in selecting one or more files in the Windows explorer and in transferring them into a control of a WINDEV window.
For example, the "WD Drag and Drop" example is used to display the image files "dropped" from the explorer.
Principle
To allow Drag and Drop to be performed from the explorer to a WINDEV application, the different steps are as follows:
  1. Enable the ability to perform a Drag and Drop from the explorer (ExplorerAccept).
  2. To process the action performed by the user, associate a WLanguage procedure with the drop of the file in the window (Event).
  3. In the procedure called whenever a file is dropped in the window, retrieve the characteristics of the "dropped" file with ExplorerRetrieve.
Functions specific to the Drag and Drop from the explorer
The following functions are used to manage Drag and Drop from the Windows explorer to a window of a WINDEV application.
ExplorerAcceptEnables or disables the ability to perform "Drag and Drop" from the Windows explorer to a WINDEV window or control.
ExplorerRetrieveRetrieves the number and the name of the files "dropped" from the explorer.
Programming

Enabling the management of Drag and Drop from the explorer to the window

To enable the ability to perform Drag and Drop from the explorer to a window, you must declare in the initialization code of the window:
  • the implementation of Drag and Drop,
  • the event used to link a specific WLanguage procedure (GetFiles in our example) to the drop action (Windows event WM_DROPFILES equal to 563). This procedure is a procedure local to the window.
    ExplorerAccept(True, "")
    Event("GetFiles", "*.", 563)

Processing the "dropped" files

In the procedure called whenever files are "dropped" in the window, you have the ability to get information and to process the relevant files.
In our example, ExplorerRetrieve allows you to:
  • find out the number of files "dropped" from the explorer,
  • retrieve the name and the path of each file and display it in a new window.
// Number of files dropped in the application by Drag and Drop
NbFile is int = ExplorerRetrieve(_EVE.wParam)
sFileName is string
// Retrieve all the files
FOR i = 1 TO NbFile
sFileName = ExplorerRetrieve(_EVE.wParam, i)
OpenDocument(sFileName)
END
Related Examples:
Drag and drop Unit examples (WINDEV): Drag and drop
[ + ] Using Drag & Drop with the WLanguage functions.
The following topics are presented in this example:
1/ How to manage Drag&Drop between WINDEV controls
2/ How to manage Drag&Drop from the Windows file explorer to a WINDEV control
Drag & Drop is used to move objects via the mouse. "Drag" consists in clicking an object and moving the mouse while keeping the left button down. "Drop" consists in releasing the left mouse button.
Drag & Drop can be used with WINDEV on the List Box, TreeView, Table and Image controls.
WD Zip Complete examples (WINDEV): WD Zip
[ + ] This example presents the use of archiving WLanguage functions with compression.
The following topics are presented in this example:
1/ How to create an archive?
2/ How to compress and uncompress files?
3/ How to manage Drag&Drop from the file explorer of Windows to a TreeView control?
Summary of the example supplied with WINDEV:
This example allows you to create and read compressed archives in WDZ, ZIP, CAB and RAR format (in read-only). This feature can be very useful to manage the automatic backups. Furthermore, the example allows you to create multi-volume archives.
See also
Minimum version required
  • Version 9
Comments
Click [Add] to post a comment

Last update: 06/22/2023

Send a report | Local help