January 26, 2023, 10:29:22 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Drag&Drop in edit control

Started by sapero, May 07, 2009, 04:09:18 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

sapero

May 07, 2009, 04:09:18 AM Last Edit: May 07, 2009, 04:44:49 AM by sapero
This example shows how to implement drag'n'drop in standard edit control.
First we need to subclass the control and call RegisterDragDrop in order to accept dropped text.
In the subclass function we just trap WM_DESTROY (cleanup) and WM_LBUTTONDOWN (drag-drop start). If there is selected text and the mouse is over it, call DragDetect api to check if the drag-drop was started. If DragDetect returns TRUE, call DoDragDrop to start.
Optional WM_MOUSEMOVE handler may change the cursor to arrow, if the mouse is over selected text.

To enable drag-drop in single edit control, call EnableDragDrop(handle, enable)