LMD NG Drag&Drop is a part of Next Generation (NG) package suite. All these packages are based on new IDE and language features of latest Delphi IDE versions.
NG Drag&Drop provides the ability to exchange data with other applications via standard Windows OLE drag&drop protocol. There are a lot of common applications, which uses Windows drag&drop:
•Windows Explorer (shell) - allows to drag/receive real or virtual file objects.
•MS Office application (Word, Excel, Outlook, ect), WordPad, other text editors - allows to drag/receive ANSI, Unicode, RTF and HTML text data, images, metafiles, files.
•Internet Browsers (Internet Explorer, Google Chrome, ect) - allows to drag/receive URLs (to open new page or as a bookmark), text (as search query to open new page), files (as downloads).
•Adobe Photoshop - allows to drag/receive images.
•many other high quality Windows applications actually support drag&drop.
OLE drag&drop protocol declares two sides, which participate in data exchange:
•Source side provides the data and initiate data dragging. Please look at Data Dragging as Source section.
•Target side receives dragging data, and handle data drop. Please look at Data Accepting as Target section.
NG Drag&Drop supports both sides, and so, the application, which uses the package, can act as data source or (and) as data target. Dragging data is called data object, and its a collection of user data stored in predefined formats. There are a lot of standard data formats, which allows to send/receive text, RTF, HTML, images, files, URLs, and are built-in NG Drag&Drop package. The following standard/common formats are implemented:
•CF_TEXT and CF_UNICODETEXT - for dragging ANSI and Unicode text data.
•CF_BITMAP and CF_DIB - for dragging bitmaps.
•CF_ENHMETAFILE and CF_METAFILEPICT - for dragging Windows metafiles.
•RTF - for RTF text.
•HTML - for HTML text.
•INETURLA and INETURLW - for ANSI and Unicode URLs.
•CF_HDROP - for dragging real existing files.
•FILEDESCRIPTOR and FILECONTENTS - for dragging virtual files.
Users application, acting as a data source, can configure data object to include any desired combination of data formats. As well, application acting as a target can support any desired formats combination, accepting only required formats.
NG Drag&Drop provides a way for declaring custom formats. Custom formats have they own unique names, and mostly used inside the application to transfer specifically formatted application data or to prevent other applications to receive dragging data. Custom formats can be implemented on top of any other built-in formats, just overriding format's name; or, from the scratch, by overriding data reading and writing methods.
Please look at Data Formats section to learn more about supported data formats.
NG Drag&Drop include the following components, accessible from the Delphi's component palette at design-time:
•TNGDropSource - allows to configure dragging data and initiate drag&drop operation (source side).
•TNGDropTarget - allows to receive dragging data by registering some application's control as a drop target and providing related events like OnDragEnter, OnDragOver, OnDragLeave, OnDrop; and a single OnDragAction event, which can be used instead of all previously mentioned events to simplify code.
Also, each supported data format is represented as a class descendant from TNGDataFormat base class, for example, TNGTextFormat, TNGUnicodeTextFormat, TNGBitmapFormat, ect. Moreover, each built-in data format class has its shortcut alias like CF.TEXT, CF.UNICODETEXT, CF.BITMAP, which are declared to make user's code more understandable.
NG Drag&Drop provides Fluent Interface API , which is an easy and very convenient way for supporting drag&drop operations, without placing any component on the form. API supports both source and target parts. For example, data dragging (source part) can be initiated as follows:
Following is a short feature list of NG Drag&Drop package:
•TNGDropSource component, which allows to drag data from customer's application to any other drag&drop enabled applications.
•TNGDropTarget component, which allows to receive data from any drag&drop enabled application.
•Formal dealing of data formats. Any data drag operation can include any number of formats in dragged data object. There no restrictions of format combinations used. Any drop target as well can be configured to accept any combination of data formats.
•Built-in standard and common formats implementation:
•TNGDataFormat base data format class can be subclassed for advanced implementation of complex custom formats. Simple custom formats could be defined declaratively on the top of any existing format class using CustomFormat attribute.
•Data format types shortcuts, such as CF.TEXT for TNGTextFormat, or CF.RTF for TNGRtfFormat.