First you should decide which CAPI pane(s) and interfaces will support dropping, where exactly dropping should be allowed, and what should occur on dropping for each data format that is made available.
You can also supply
:drop-callback for an interface. When the user drags an object over a window, the system first tries to call the
of any pane under the mouse and otherwise calls the
of the top-level interface, if supplied.
The drop-callback receives as arguments a drop-object which is used to communicate information about the dropping operation and stage which is a keyword. The drop-callback is called at several stages: when the pane is displayed; when the user drags over the pane; and when the user drops over the pane. Various functions are provided which you can use to query the drop-object and set attributes appropriately.
You will use set-drop-object-supported-formats to specify the data formats that it wants to receive. The
:string format can be used to receive a string from another application and the
:filename-list format can be used to receive a list of filenames from another application such as the Macintosh Finder or the Windows Explorer. Any other keyword in formats is assumed to be a private format that can only be used to receive objects from within the same Lisp image.
You can use drop-object-provides-format to query whether a given data format is actually available, and then you can call
(setf drop-object-drop-effect) to modify the effect of the dropping operation .
Finally, at the
:drop stage, you will use drop-object-get-object to retrieve (for each data format) the object which was returned by the
, and then do something with this object, typically copying or moving it to the pane in some way.
Additionally within the drop-callback of a list-panel or tree-view you can use drop-object-collection-index (or drop-object-collection-item) to query the index (or item) where the object would currently be dropped.
Below is a more sophisticated version of
add-list-item which inserts the item at the expected position within the list. This position is obtained using drop-object-collection-index:
Supply the special
:default to implement dropping text in an editor-pane.
CAPI User Guide and Reference Manual (Windows version) - 3 Aug 2017