<doc>
  <legacy_id>1774</legacy_id>
  <name>dragEnd</name>
  <type>message</type>
  <syntax>
    <example>dragEnd</example>
  </syntax>
  <library></library>
  <objects>
  </objects>
  <synonyms>
  </synonyms>
  <classification>
    <category>User Interaction</category>
  </classification>
  <references>
    <function tag="dragSource">dragSource Function</function>
    <function tag="dragDestination">dragDestination Function</function>
    <property tag="acceptDrop">acceptDrop Property</property>
    <message tag="dragDrop">dragDrop Message</message>
    <message tag="mouseRelease">mouseRelease Message</message>
    <property tag="dragImage">dragImage Property</property>
  </references>
  <history>
    <introduced version="2.0">Added.</introduced>
  </history>
  <platforms>
    <mac/>
    <windows/>
    <linux/>
  </platforms>
  <classes>
    <desktop/>
    <server/>
  </classes>
  <security>
  </security>
  <summary>Sent to the <glossary tag="object">object</glossary> a <glossary tag="drag and drop">drag and drop</glossary> started from, when the data is dropped.</summary>
  <examples>
    <example>on dragEnd <i>-- remove data being dragged</i></p><p>  delete the dragSource</p><p>end dragEnd</example>
  </examples>
  <description>
    <p>Handle the <b>dragEnd</b> <keyword tag="message box">message</keyword> to perform an action when the user drops data, or <glossary tag="trap">trap</glossary> the <keyword tag="message box">message</keyword> to prevent text from being deleted from a <keyword tag="field">field</keyword> when it's dragged to another <keyword tag="field">field</keyword>.</p><p/><p><b>Comments:</b></p><p>The <b>dragEnd</b> <keyword tag="message box">message</keyword> is sent to the <keyword tag="control">control</keyword> that the drag started from. If the data is not dropped onto a <keyword tag="control">control</keyword> that accepts it, the <message tag="dragEnd">dragEnd</message> <keyword tag="message box">message</keyword> is still sent.</p><p/><p>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 text is deleted from the source field automatically when LiveCode receives the <b>dragEnd</b> <keyword tag="message box">message</keyword>.</p><p/><p>To prevent the dragged text from being automatically deleted from the source field when it's dropped onto another unlocked field, trap the <b>dragEnd</b> <keyword tag="message box">message</keyword>. If you don't want text from a particular <keyword tag="field">field</keyword> to be deleted after dragging, place a <b>dragEnd</b> <glossary tag="handler">handler</glossary> in the <keyword tag="field">field</keyword> that does not contain a <control_st tag="pass">pass</control_st> <glossary tag="control structure">control structure</glossary>:</p><p/><p>  on dragEnd <i>-- in script of field or one of its owners</i></p><p><i>-- do nothing, but trap the message</i></p><p>  end dragEnd</p><p/><p>On the other hand, if you want to perform some action when text is dragged from an unlocked field and then dropped, you need to pass the <b>dragEnd</b> <keyword tag="message box">message</keyword> once you're done with it in order to allow the deletion to take place:</p><p/><p>  on dragEnd</p><p>    set the textColor of me to "gray"</p><p>    pass dragEnd <i>-- needed for text removal to occur</i></p><p>  end dragEnd</p><p/><p>To make changes to the original data in a locked field or a control other than a field when a drop is completed, handle the <b>dragEnd</b> message. For these objects, if you want the dragged data to be removed (or changed), your <b>dragEnd</b> <glossary tag="handler">handler</glossary> must delete the dragged text from the source <glossary tag="object">object</glossary> (or perform whatever action you want to do on a drop); the behavior is not automated as it is for <glossary tag="unlock">unlocked</glossary> <glossary tag="field">fields</glossary>.</p>
  </description>
</doc>