Boxes, Grids, & Snap to Objects

Klaus Major kmajor at
Tue Feb 19 05:49:01 EST 2002

Hi Ian,

> I don't like the grab command,  it seems to me program flow doesn't 
> stop,
> i.e.
> Grab me
> Beep
> Will beep immediately even though you're still dragging the thing 
> around the
> screen.  This means you'll need to use a mouseup handler to do the new
> location stuff instead.
> I find it much better to hide the cursor, and set loc of the object 
> needing
> dragging to the mouseloc,  this is done in a "repeat while the mouse is
> down" loop and lets me do clever things,  I can check if the mouseloc is
> within the bounds of another object, and if so hilite that object, etc.
> It's much more flexible.
> ...

maybe you missed some of the previous posts, where experts (!) are 
advising to
not poll the mouse-state.

It is far more efficient to use the mousemove function.

Like this one:

local ok_to_drag

on mousedown
   put true into ok_to_drag
end mousedown

##set flag...

on mouseup
   put false into ok_to_drag
en mouseup

##unset flag

on mousemove x,y
  ## this is the advantage of the mousemove funcion,
  ## the loch and locv of the mouse are being passed as
  ## parameters in this function...

  if ok_to_drag then

  ##... your stuff here...

   end if
end mousemove

Hope this helps...


Klaus Major
kmajor at

More information about the Use-livecode mailing list