A drag source widget has a
dragDetectCallback hooked that sends the
dragStart:argBlock: method of
CwWidget. To start a drag from a drag source widget, the user holds down a mouse button while over the widget and moves the mouse to a different location.
The CwWidget to which the
dragDetact callback hooks (aCwWidget)
The clientData specified when the
dragDetect callback was hooked (
nil)
The CwDragDetectCallbackData instance contains a
ButtonPress event that can determine the mouse position and button when the button is pressed. The
callData reason is either
XmCRDRAG or
XmCRDRAGSELECT.
An application starts a drag from a dragDetect callback handler by sending
dragStart:argBlock: with a
CwDragContext create argBlock to the widget that received the callback. Sending
dragStart:argBlock: creates a
CwDragContext which represents the drag source for the duration of the drag and drop operation. Only one instance of
CwDragContext can exist at any time, and the instance ceases to exist when the drag and drop operation is complete.
The dragStart:argBlock: message must only be sent from a
dragDetect callback handler or a button press event handler. The first parameter must be the button press event that initiated the drag.
The CgIcon that replaces the mouse cursor during dragging.
The following code shows a typical dragDetect callback handler. It starts a drag, specifying the operations and targets that the drag source supports and hooking a
convertProc to handle the source side of the data transfer. Assume that
self dragIcon answers a
CgIcon.
Copyright 2005, 2020 Instantiations, Inc. All rights reserved.