April 19, 2024, 05:36:55 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


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)