Result = DragText(Text$ [, Actions])
Starts a Drag & Drop operation with text data.


Text$ The text to drag.
Actions (optional) A combination of the Drag & Drop actions that should be allowed for the data. If the parameter is not specified, #PB_Drag_Copy will be the only allowed action. Possible actions are: (they can be combined with '|')
  #PB_Drag_Copy: The text can be copied
  #PB_Drag_Move: The text can be moved
  #PB_Drag_Link: The text can be linked
The user can decide which of these actions to take by pressing modifier keys like Ctrl or Shift. The actions that can really be taken also depend on the actions allowed by the drop target. (On MacOSX, the actions are only treated as a suggestion. The drop target can still choose another action.)

Return value

Returns one of the above Drag & Drop action values to indicate what action the user took, or #PB_Drag_None if the user aborted the Drag & Drop operation.

Note that if #PB_Drag_Move is returned, it is your responsibility to remove the dragged text data from your application.


Drag & Drop can basically be started any time, but the left mouse button should be currently pressed as otherwise the operation will end immediately without success. The usual time to start a Drag & Drop operation is when a Gadget reported an event with EventType() of #PB_EventType_DragStart.

See Also

DragFiles(), DragImage(), DragPrivate(), DragOSFormats(), SetDragCallback()

Supported OS

Windows, Linux

<- DragPrivate() - DragDrop Index - EnableGadgetDrop() ->