- Functions specific to the Drag and Drop from the explorer
- Enabling the management of Drag and Drop from the explorer to the window
- Processing the "dropped" files
Drag and Drop from the explorer
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.
To allow Drag and Drop to be performed from the explorer to a WINDEV application, the different steps are as follows:
- Enable the ability to perform a Drag and Drop from the explorer (ExplorerAccept).
- To process the action performed by the user, associate a WLangage procedure with the drop of the file in the window (Event).
- 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.
|ExplorerAccept||Enables or disables the ability to perform "Drag and Drop" from the Windows explorer to a WINDEV window or control.|
|ExplorerRetrieve||Retrieves the number and the name of the files "dropped" from the explorer.|
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.
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.
- 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)
Unit examples (WINDEV): Drag and drop
Complete examples (WINDEV): WD Zip