Dragging widgets

hh hh at hyperhh.de
Tue Feb 28 14:55:34 EST 2017

> Richmond wrote:
> So . . . can any one tell me how to effect a "grab" (which is the same 
> whether with a PNG image, a button or a graphic object) with a widget?

There is one way that is acting similar to a "grab": Put the following
into your card's script. Works for widgets and any 'usual' control that
doesn't block mouseDown.

on mouseDown
   if the short name of the target is "svgTURTLE" then # <-- use any filter
      put the mouseControl into mC; put false into mUp
      put the clickH - item 1 of the loc of mC into dx
      put the clickV - item 2 of the loc of mC into dy
      repeat until the mouse is up
         set loc of mC to (the mouseH-dx,the mouseV-dy)
      end repeat
    end if
end mouseDown

Using a "send in time" is not possible for that, because the click is then
passed 'in between' to the control/widget. You sadly have to poll the mouse.

More information about the use-livecode mailing list