PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • 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/iPadApple WatchUniversal Windows 10 AppWindows Mobile
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 WLangage 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.
Versions 09 and later
ExplorerAccept
New in version 09
ExplorerAccept
ExplorerAccept
Enables or disables the ability to perform "Drag and Drop" from the Windows explorer to a WINDEV window or control.
Versions 09 and later
ExplorerRetrieve
New in version 09
ExplorerRetrieve
ExplorerRetrieve
Retrieves 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)
OpenImage(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 do I create an archive?
2/ How do I compress and uncompress files?
3/ How do I manage the 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.
Minimum required version
  • Version 9
Comments
Click [Add] to post a comment