Getting drag and drop to copy (not cut) dragged text

depstein at att.net depstein at att.net
Sat Oct 25 19:57:25 EDT 2003


It appears to me that if we select some text from a Metacard 2.5 field and drag 
and drop it elsewhere, then
-- if the drop occurs outside Metacard, the dragged text remains in the original 
field, while
-- if the drop occurs inside Metacard, the dragged text is deleted from the 
original field.

I am trying to override this behavior when text is dropped to a locked field, 
i.e., I want the dragged text to be displayed in the locked field but remain, still selected, 
where it was in the original field.  The following procedure does not work:

In the card script:

on dragStart
  global textBuffer,locBuffer,chunkBuffer
-- these globals are used to record the starting condition of the field being dragged from:
  put the text of the target into textBuffer
  put the selectedChunk into chunkBuffer
  put the long name of the target into locBuffer
  pass dragStart
end dragStart

In the script of a locked field:

on dragEnter
  set the acceptDrop to true
end dragEnter

on dragDrop
  global textBuffer,locBuffer,chunkBuffer
  put the dragData["text"] into me  -- This works as expected.
  -- Now try to restore the pre-drag content and selection of the source field:
  do "put textBuffer into" && locBuffer
  do "select" && chunkBuffer
-- But this doesn't happen.  The source field has lost the text that was dragged out.
end dragDrop

Can anyone explain what's going wrong and how to fix this?

Many thanks.

David Epstein


More information about the metacard mailing list