|
|
|
|
|
- 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
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 WLanguage 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.
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. - 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:
|
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.
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|