Name: dragStart

Type: message

Syntax: dragStart

Summary: Sent to a control when the user clicked on it and then started to drag the mouse pointer.

Associations: stack,card,field,button,graphic,scrollbar,player,image

Introduced: 2.0

OS: mac,windows,linux

Platforms: desktop,server

Example:
on dragStart -- in a field script
  -- color the text that's being dragged:
  set the textColor of the selectedChunk to "#333399"
  pass dragStart
end dragStart

Description:
The <dragStart> <message> is sent to a control when the user clicks on it and then drags the mouse pointer at least <dragDelta> pixels from its original position.  

Use this handler to initiate a drag-drop operation if required.  An operation can be initiated by setting a data-type of the <dragData property>.

LiveCode automatically handles the mechanics of dragging and dropping text between and within unlocked fields. To support this type of drag and drop operation, you don't need to do any scripting: the drag begins automatically when LiveCode receives the <dragStart> <message>.

If you don't want to allow dragging text from a particular field, you should place a <dragStart> <handler> in the field that does not contain a <pass> <control structure>:

  on dragStart -- in script of field or one of its owners
    -- do nothing, but trap the message
  end dragStart

References: dragData (property), dragData property (property), dragImageOffset (property), dragAction (property), dragDelta (property), dragEnter (message), click (command), pass (control_st), control structure (glossary), handler (glossary), message (glossary)

Tags: ui
