No mouseUp

Dick Kriesel dick.kriesel at mail.com
Tue Dec 14 19:42:36 EST 2004


On 12/13/04 11:39 AM, "Roger Guay" <irog at mac.com> wrote:

> I have the following script in a List field and the mouseUp handler
> doesn't work!  I noticed that it is the "set the dragData" line in the
> mouseDown that disables the mouseUp.  Can someone please tell me what's
> going on and how I can keep the mouseUp?
> 
> 
> on mouseDown
>  get the hilitedLines of me
>  set the dragData to line it of me
> end mouseDown
> 
> on mouseUp
>  beep 2
> end mouseUp

If you paste the following into the script of your list field, and then
drag, you can see in the message box what messages fire when.

(After you paste, you may need to delete the extra linefeeds that email line
wrapping causes.)

on mouseDown
  if the clickLine is empty then
   put param(0) & return
  else
    put param(0) && the clickLine & ": " & the value of the clickLine &
return
    set the dragData["text"] to the value of the clickLine
  end if
end mouseDown

on mouseUp
  if the clickLine is empty then
    put param(0) & return after msg
  else
    put param(0) && the clickLine & ": " & the dragData["text"] & return
after msg
  end if
end mouseUp

on dragDrop
  put word 2 of the clickLine into tMouseDownLineNumber
  put word 2 of the mouseLine into tMouseUpLineNumber
  put param(0) && "from line" && tMouseDownLineNumber && "onto line" &&
tMouseUpLineNumber & return after msg
  if tMouseUpLineNumber < tMouseDownLineNumber then -- note: moving up
    delete line tMouseDownLineNumber of me
    put the dragData["text"] & return before line tMouseUpLineNumber of me
  else if tMouseUpLineNumber > tMouseDownLineNumber then -- note: moving
down
    put return & the dragData["text"] after line tMouseUpLineNumber of me
    delete line tMouseDownLineNumber of me
  else if tMouseUpLineNumber is empty then -- note: moving past the last
line
    delete line tMouseDownLineNumber of me
    put return & the dragData["text"] after me
  else
    put "it appears to be a click on line" && tMouseDownLineNumber & return
after msg
  end if
  if the last char of me is return then put "last line is empty" & return
after msg
  set the acceptDrop to "false"
end dragDrop

on dragEnd
  put param(0) && the clickLine & ": " & the dragData["text"] & return after
msg
end dragEnd

on dragEnter
  put param(0) && the clickLine & ": " & the dragData["text"] & return after
msg
  set the acceptDrop to "true"
end dragEnter

on dragLeave
  put param(0) && the clickLine & ": " & the dragData["text"] & return after
msg
end dragLeave


HTH.  Does it?



More information about the use-livecode mailing list